Bobcares

How to fix error response from daemon: unable to remove volume

by | Sep 16, 2020

Webmasters often receive an “error response from daemon: unable to remove volume” message while attempting to remove a volume in Docker.

As a part of our Server Management Services, we help our Customers to fix Docker related errors regularly.

Let us today discuss the possible causes and fixes for this error.

What causes error response from daemon: unable to remove volume?

Docker allows us to quickly build, test, and deploy applications as portable containers that can run virtually anywhere.

Sometimes, applications may need to share access to data or persist data after a container is deleted. Databases, user-generated content for a web site and log files are just a few examples of such data.

Persistent access to data is provided with Docker Volumes.

Docker quickly accumulates a large number of unused objects. It consumes significant disk space and clutters the output produced by the Docker commands. As docker doesn’t remove unused objects such as containers, images, volumes, and networks implicitly, we may need to remove them manually.

We can remove a volume “DataVolume2” using the command:

$ docker volume rm DataVolume2

Sometimes, while removing a Docker volume, it results in the error given below:

Error response from daemon: unable to remove volume: remove DataVolume: volume is in use - [d0d2233b668eddad4986313c7a4a1bc0d2edaf0c7e1c02a6a6256de27db17a63]

This generally happens when the volume is still in use by the container. Docker will not let us remove a volume if it is referenced by a container.

Let us now look at the steps to fix this error.

How to fix error response from daemon: unable to remove volume?

To fix this error, we need to remove the container before removing the volume. From the error message that we saw earlier, the part highlighted in bold indicates the ID of the container that refer to the volume.

We can use this ID to remove the container:

$ docker rm d0d2233b668eddad4986313c7a4a1bc0d2edaf0c7e1c02a6a6256de27db17a63

Removing the container will not affect the volume. The ls command will still list this volume.

$ docker volume ls

As we have removed the container, the volume is now free for deletion. We can use the rm command to delete the Docker volume “DataVolume2”:

$ docker volume rm DataVolume2

[Need any further assistance in fixing Docker errors? – We’re available 24*7]

 

Conclusion

In short, the message “error response from daemon: unable to remove volume” triggers while attempting to remove a volume in Docker. It generally happens when the volume is still in use by a container. Today, we saw how our Support Engineers fix this error.

 

 

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

3 Comments

  1. Ben Nadel

    Thank you! I’m not very good at Docker yet and was running into this error. For some reason, the container in question wasn’t showing in the list of containers. Maybe it was only showing running containers, not stopped ones. Not sure. But, I was able to remove it using the rm command, which allowed me to remove the volume.

    Reply
    • Hiba Razak

      Glad to know that our article helps you solves the issue.

      Reply
  2. Martin

    thanks, it works.

    Reply

Submit a Comment

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

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF