Play Video about Docker image to TAR
Table of Contents
1. Introduction
If you have server without internet access and you want to use certain docker image, you can export it on another host to TAR archive and transfer back to isolated server. This way you can load TAR into docker image and use it.
2. Export image to TAR
Image name and tag together is your identification. To obtain them list images info
docker images --format "table {{.Repository}}\t{{.Tag}}\t{{.Size}}" | head
Now export particular image by using name:tag
docker save image:tag > /tmp/imageNameTag.tar
3. Transfer to another host
You can transfer directly with scp to another host or use online storage as proxy
# scp to another host
scp /tmp/imageNameTag.tar tomd@someServer:/tmp/imageNameTag.tar
# eventually upload it to restricted machine or to common place
curl -XPUT -u username https://someplaceonline.com/imageNameTag.tar -T /tmp/imageNameTag.tar
# on the restricted machine download tar file
curl -XGET -u username https://someplaceonline.com/imageNameTag.tar -O
4. Load image to local repository
Image is right now in your local filesystem of restricted host. Load image to local docker repository
docker image load < /tmp/imageNameTag.tar
you can rename image to fit naming convention or keep it as it is
docker tag docker.io/name:tag yourRepoName:tag
5. Final thoughts
In this way, you can bypass some restrictions and continue making progress on your work.
Have a nice coding!