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:

[code]
sudo yum install docker
mkdir ~/containers && cd ~/containers
scp justin@reiners.io:/path/to/outfile.tar .
#import
sudo docker import outfile.tar reiners.io/test
#run
sudo docker run –name imagename -ir reiners.io/test -p 9000:9000 bash –restart always
[/code]

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

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

Leave a Reply

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