The most common way to share docker images is by using the Docker Hub. So you can easily get a docker image by using the command (for postgres) docker pull postgres
and you can push it to Docker Hub with the command docker push <username/tagname>
. Let’s see how we can share docker images by skipping Docker Hub. We will create a tar file as follows:
Creation of image tar file from Docker image
docker save <username/tagname> > myname.tar
So if my image was gpipis/predictivehacks
and I wanted to store it to a file called myshared.tar
it would be:
docker save gpipis/predictivehacks > myshared.tar
Load an image from a tar file
Now, since we have the tar
file we can load the image as follows.
docker load -i myshared.tar