I have a docker container that is around 160GB in size (virtual/total size).
I need to move this container to another server.
I understand that I could save the container into a docker image, copy the image into another server, then revive the container on the new server.
Considering the large size of the container, is there a way to move it to another server without having to save it to an image?
Our challenge is:
disk space, there may not be enough space in the current server to do commit plus save the image
down-time, would like to minimize down time while the container is committed and saved to image
Also, what’s the best way to investigate what’s the 160GB is used for in the container? i.e: is the docker framework itself use a lot of disk space?
How have you been able to have a container with 160GB?
Seems like you did not map any docker volumes (from host or remote shares like nfs/cifs) into your container to store persistent data there… Did you?
Containers are supposed to be ephemeral/dispossable, as such the normal approach would be to throw away the container and backup the source of the docker volume. if I understood you right, in your case those would mean a total loss of data.
If you didn’t persist data in volumes, then there is no way around this! Once you create a container based on the image of your old containers export, you should consider working with volumes. They make like easier and less risky coug
Nope, there is no way to add/remove a volume to an existing container.
If you are lucky, the image declares one or more volumes that you didn’t map to a volume. If so, the data might be stored in /var/lib/docker/volumes/?/_data.
Please share the output of this command:
docker inspect --format '{{ range .Mounts }} host: {{.Source }} -> container: {{.Destination}}{{ printf "\n" }}{{ end }}' {containerid}
Well, if mounts is empty then its to be expected that the command gives an emtpy result.
I am afraid you only solution is docker export/docker import.Good luck!
Update: try to check if your files are available via merged dir. You can find the location with docker inspect --format '{{ .GraphDriver.Data.MergedDir }}' {containerId}.