Moving a docker container to a new host without dockerhub

I’m getting started using docker for somethings. I needed to move a container from a test machine to a new production home. This is how I did it. If there is a better way, please let me know!

I ran this where the machine was in development:

[code]sudo docker export container –output outfile.tar[/code]

on the destination machine I did the following:

sudo yum install docker
mkdir ~/containers && cd ~/containers
scp .
sudo docker import outfile.tar
sudo docker run –name imagename -ir -p 9000:9000 bash –restart always

once you are done with that, you should be able to see your imported image listed:

sudo docker images ls
[justin@development images]$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE latest 92e2e1eab9fe 58 seconds ago 1.13 GB

Leave a Reply

Your email address will not be published. Required fields are marked *