Blog

How to remove mounted volumes from working docker instances?

There may be other ways to unmount a volume from a working docker instance, but using the way below you can unmount any volume right away.

On the docker instance itself, try these commands:

df -h

You will see a list of all the mounts.

overlay         310G  160G  151G  52% /

tmpfs            64M     0   64M   0% /dev

tmpfs           7.7G     0  7.7G   0% /sys/fs/cgroup

shm              64M     0   64M   0% /dev/shm

/dev/sda1       310G  160G  151G  52% /etc/hosts

/mnt/hdd2      310G  160G  151G  52% /mnt/hdd2

Now check the last column of the result and copy the path of the mount you want to remove and run this command:

umount -l /mnt/hdd2

Please note that you will have to do it every time your docker instance restarts, so please add this command to your startup scripts.

Cheers!

Leave a Reply

Your email address will not be published. Required fields are marked *