Skip to content

Instantly share code, notes, and snippets.

@jctosta
Last active February 2, 2023 12:26
Show Gist options
  • Save jctosta/b4f0fb541033c1f68bad to your computer and use it in GitHub Desktop.
Save jctosta/b4f0fb541033c1f68bad to your computer and use it in GitHub Desktop.
Docker - Comandos Úteis

Docker - Comandos Úteis

Containers

  • Abrir um shell em um container em execução:
    • docker exec -t -i <container_id> <shell>

Limpeza

  • Excluir containers com status equivalente a Exited:
    • docker rm -v $(docker ps -a -q -f status=exited)
  • Remover imagens não utilizadas do cache local:
    • docker rmi $(docker images -f "dangling=true" -q)
  • Limpar o diretório de volumes (vsf) do docker:
    • docker run -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker:/var/lib/docker --rm martin/docker-cleanup-volumes
@diogoX451
Copy link

Perfect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment