Docker Community Forums

Share and learn in the Docker community.

Re-create container with same config off new image


(Collinp) #1

Is there a quick/easy way to re-create a running container with all its options intact? I have a container (running remotely in Digital Ocean) that was started from a compose up command on my laptop. There are numerous option used such as volumes, ports, etc… Now I have a new image for my container and I simply want to re-create it. However I do not want to use compose as I want to be able to do this fully remotely from the server. It is also not as simple as a docker rm and docker run as I don’t have all the options/arguments that compose used to create the server.

Is there some kind of quick/easy way to re-create a container on an updated image and keep all its options/config? Basically do what compose does, on an environment were compose doesn’t exist.


(Jeff Anderson) #2

There isn’t a simple mechanism that will generate all the config options, but you can do a docker inspect on the container and see every aspect of that container. You can build a command from that information.

Docker compose does work with a remote docker daemon. Just make sure you’re not using compose’s relative paths for host volumes, and it should work just fine.