Docker Community Forums

Share and learn in the Docker community.

How to unmount a volume from a running container?

(Manh3141) #1

Hi guys,

I have another question. This time it’s about removing / unmounting a volume from a running container. My situation: I’m currently using a data container to store some installation files from the host. Then, I use --volumes-from in order to mount the volume from the data container to another container. After I’ve installed the files, I want to create an image based on this container. BUT if I do it without unmounting the volume, it will be included to the image. This is what I want to avoid - I don’t want the installation files to be included.

I have tried stopping the data container, but this didn’t help. It seems to me that there is no possibility to remove the volume from a running container. Does anybody have an idea?

(Donaldr) #2

Did you ever figure this out? I’m having a similar issue.

(h4662986) #3

i have the same problem. Did you find the solution in these two years?

(Metin Y.) #4

It is simply not possible. The only changes applied to a running containers are ressource limits and restat policies (docker container update ...).

The correct approach is to delete the current container and re-create a container with the same parameters except the unwanted volume mappings.

If its regarding image build: [](http://multi-stage builds) solves your problem.