DEV Community

Jaydeep Patil
Jaydeep Patil

Posted on • Edited on

1

Docker Image Import and Export to another Machine

Image description

We faced daily challenges while working with docker many times we want to save our running images and want to import/export them to another machine and load them on that machine and used them directly without too much configuration.

So Let’s start,

To commit the running container to an image with the new tag you can use this command :

docker commit <containerID> new_image_name:tag

If you want to know the running container id then use the following command

docker ps

To save the replica of the image which we created using the above command using the following command

docker save -o new_file_name.tar new_image_name:tag

After executing the above command you can see the .tar file of your image on your machine from the location where you executed the above command

Now you can move your docker-compose.yml to the same folder on another machine and your new_file_name.tar too. On your machine where are these files run :

docker load --input new_file_name.tar

Change all docker-compose.yml files as per image we load with name and its tag

If you lost the name used:

docker images

The last step is run :

docker-compose up -d

I hope you understand all the things which I discussed in this article.

Happy Learning!

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs