Ship Final Docker Image to another computer
There are 2 ways to ship your final Docker image to another computer:
- You can save your image to a tar file and then transfer the tar file to the other computer and load it there.
- Or, you can push your image to a Docker registry (like Docker Hub) and then pull it from the other computer.
Save and Load Docker Image
# Save the Docker image to a tar file, my-image.tar.
docker save -o my-image.tar my-image:latest
# Transfer my-image.tar to the other computer using scp, rsync, or any file transfer method.
# Then, load it.
docker load -i my-image.tar
Push and Pull Docker Image
You need to create an account on Docker Hub and log in to push your image to the registry. Then, you can pull the image from the other computer using the same account.
# Login
docker login
# Tag your image with the registry name, e.g., myusername/my-image:latest.
docker tag my-image:latest myusername/my-image:latest
# Push the image to the Docker registry.
docker push myusername/my-image:latest
# Then, on the other computer, pull the image from the registry.
docker pull myusername/my-image:latest