I have a 5GB docker image named "ubuntu-dev-update-15", which I developed on my local Ubuntu 14 dev machine. In that image I have everything I need to do my development work. Now I need to be able to send this image to a different linux host. What is the procedure for doing that?
A Docker image has many layers, and each image includes everything needed to configure a container environment -- system libraries, tools, dependencies and other files. Some of the parts of an image include: Base image. The user can build this first layer entirely from scratch with the build command.
A multistage build allows you to use multiple images to build a final product. In a multistage build, you have a single Dockerfile, but can define multiple images inside it to help build the final image.
Use of two commands – FROM and AS, in particular, allows you to create a multi-stage dockerfile. It allows you to create multiple image layers on top of the previous layers and the AS command provides a virtual name to the intermediate image layer.
If your different linux host is on the same network you can transfer saved image using FTP or local HTTP server or share to transfer the file locally. Usage of Save :
docker save [OPTIONS] IMAGE [IMAGE...]
Example : sudo docker save -o ubuntu.tar ubuntu:precise ubuntu:unicorn
where -o
saves to a file, instead of STDOUT.
Transfer this tar file to the other linux host.Load this tar file in the new host using: docker load [OPTIONS]
Example: sudo docker load --input fedora.tar
where --input
reads from a tar archive file, instead of STDIN.
Docker hub is one option to move your file. But from a production point of view it is better to run a registry(place to store images) in the machine where you want to send your image .
For example you want to send your image from system1 to system2. Let your image name be my_image.
Now open a registry in system1 by running
docker run -p <system1-ip>:5000:5000 -d registry
push your image into that registry :
You need to rename the image with :5000/my_image by using tag option
docker tag my_image <system1-ip>:5000/my_image
Now push into registry by using push command
docker push <system1-ip>:5000/my_image
Now go to system2 and pull your image from registry .
docker pull <system1-ip>:5000/my_image
This is the most secured way of transferring images. Reference link creating a private repository
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With