Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

541
Visualizações
How to free wasted space used by docker?

I set up docker on my server. I use Jenkins for CI. Those tools are really cool. But, unfortunately, I still can't figure out how to get the wasted space back.

I tried different things proposed on the web and by using them I can only free a part of the wasted space. I need no any history and etc.

I tried different things, like rude docker rm $(docker ps -aq) and docker rmi $(docker images -q) while some of containers are running that make them prevented from deletion.

I also tried this script and similar.

#!/bin/bash

# remove exited containers:
docker ps --filter status=dead --filter status=exited -aq | xargs -r docker rm -v

# remove unused images:
docker images --no-trunc | grep '<none>' | awk '{ print $3 }' | xargs -r docker rmi

# remove unused volumes:
find '/var/lib/docker/volumes/' -mindepth 1 -maxdepth 1 -type d | grep -vFf <(
  docker ps -aq | xargs docker inspect | jq -r '.[] | .Mounts | .[] | .Name | select(.)'
) | xargs -r rm -fr

I would like to expect that after first build of all images I have fixed size of the stuff by applying the clean up commands above. In other words I want the subsequent builds with clean up applied doesn't make the wasted space grow.

But anyway every execution of docker build occupies new space that I can't free up.

The directory /var/lib/docker/overlay grows up and doesn't consider my clean ups eventually.

Where am I wrong?

about 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

In the latest versions of Docker, you can now use docker system prune command (with --all option for complete cleanup).

https://docs.docker.com/engine/reference/commandline/system_prune/

about 4 years ago · Santiago Trujillo Relatório

0

In order to remove volumes use:

docker volume prune

In order to remove networks use:

docker network prune

In order to remove all stopped containers use:

docker container prune

In order to remove unused images use:

docker image prune
about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda