user7898461
user7898461

Reputation:

Copy Docker image to running container

Is there a way to copy a Docker image to a running container? Or perhaps the way to do it is to start a container with the new image and share a volume between it and other containers? Is there a way to add a volume to a running container? Basically, the rational is for running processes/containers where I don't want to restart them or rebuild them.

Upvotes: 0

Views: 67

Answers (1)

Mihai
Mihai

Reputation: 10767

Containers run based on an image. There is no such thing as copy an image to a container (running or not running).

Also you cannot (so far) create volumes on a running container. You would have to recreate it with the new volumes.

You can however start a container and instruct it to use the volumes from a different container. But again, you are starting a new container.

From my experience containers are meant to either start, do their thing and exit, or start and do the same thing over and over again in exactly the same way (serve an application, run a webserver, etc) until shut down. Changing things on a running container is a bad practice and has no benefit.

Upvotes: 1

Related Questions