Home Interests Docker

How to Remove Orphaned Volumes in Docker

howchoo   (467)
August 22, 2023
3 minutes

Share

Interests
Posted in these interests:
docker • 4 guides

When using Docker sometimes it’s necessary to do some cleanup in order to free up space. I ran into an issue recently where I could not start my database container. The error message was:

db_1     | creating subdirectories ... initdb: could not create directory "/var/lib/postgresql/data/global": No space left on device

One simple way to free up space is to delete dangling or orphaned volumes. A dangling volume is a volume that is not referenced by any container.

1 – docker volume rm $(docker volume ls -qf dangling=true)

Let’s break this down.

First, if you want to see a list of the dangling volumes you can simply run:

docker volume ls -qf dangling=true

docker volume ls lists the volumes and -qf means list only the ids and filter on dangling=true.

To delete these volumes we’ll pass them in to the docker volume rm function which takes a volume id or list of ids. The final command is:

docker volume rm $(docker volume ls -qf dangling=true)
NEXT UP

How to Run a Raspberry Pi Cluster with Docker Swarm

An in-depth Raspberry Pi cluster example.
howchoo   (467)
September 20, 2023

A cluster is a group of computers performing the same task, operating as a single system. Although Raspberry Pi’s are pretty incredible devices, a single Pi can only do so much. A Raspberry Pi cluster can be used anytime you want to improve performance or availability, and there are many use cases including serving web

Continue Reading

howchoo

 467 guides

Introducing Howchoo, an enigmatic author whose unique pen name reflects their boundless curiosity and limitless creativity. Mysterious and multifaceted, Howchoo has emerged as a captivating storyteller, leaving readers mesmerized by the uncharted realms they craft with their words. With an insatiable appetite for knowledge and a love for exploration, Howchoo's writing transcends conventional genres, blurring the lines between fantasy, science fiction, and the surreal. Their narratives are a kaleidoscope of ideas, weaving together intricate plots, unforgettable characters, and thought-provoking themes that challenge the boundaries of imagination.

Discover interesting things!

Explore Howchoo's most popular interests.

Explore