Move docker stuff to another machine

0

I was running docker stuff in a ubuntu ec2 instance but something happened (Amazon AWS EC2 Volume issue prevents instance access via SSH) and it's not running anymore.

I'm thinking in move the docker stuff to another amazon linux ec2 instance. In general, what should be copied to the new machine?

I'm asking for a slightly different method of moving than is explained at https://blog.giantswarm.io/moving-docker-container-images-around/. Since I do not have access to the running instance anymore. But I have access to the filesystem. I'm afraid this means I lost all the configuration in the containers.

KcFnMi

Posted 2017-06-15T17:43:19.997

Reputation: 396

Answers

0

I don't know about the nature of the failure that you experienced. "Something" doesn't exactly tell me much. But if you have no other choice, you can reach the layer definitions and rootfs of each container. Before you attempt this be sure you have no other option. Any slip up here will permanently corrupt the container. So I would start with a non-symbolic copy.

You could also just copy the files you wish to safe from the container file structure if you wish. Just make sure not to mess anything up in the container itself.

Go to:

cd /var/lib/docker/aufs/mnt/

see what you can find in there, if you ll this directory you should see a bunch of directories with long alphanumeric names. each of these represents an image. When you type docker ps you get a short hand of these numbers. Search for your image. Once you find it you can simply navigate inside and be very careful from here on out.

enter image description here

Here is one of mine. Anything that was not added by a layer or by you in your dockerfile, a volume, etc... will be a symbolic link. The rest will be your files.

Remember this is a last resort recovery. You may destroy the container tinkering around in here. So be careful.

Nalaurien

Posted 2017-06-15T17:43:19.997

Reputation: 833