Skip to content

Instantly share code, notes, and snippets.

@AhmedSakrr
Forked from jctosta/docker_cheatsheet.md
Created October 21, 2021 20:52
Show Gist options
  • Select an option

  • Save AhmedSakrr/dcc08475c75f3e0e0693cef58ebb64ea to your computer and use it in GitHub Desktop.

Select an option

Save AhmedSakrr/dcc08475c75f3e0e0693cef58ebb64ea 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment