Skip to content

Instantly share code, notes, and snippets.

@eesa1980
Last active May 13, 2022 10:00
Show Gist options
  • Save eesa1980/776b210917f8996ecbc238f9d43b3de1 to your computer and use it in GitHub Desktop.
Save eesa1980/776b210917f8996ecbc238f9d43b3de1 to your computer and use it in GitHub Desktop.
Docker Commands #docker #commands #dockercommands

Start (run)

$ docker run -dp 8080:8080 -it <container-name>

Build

$ docker build . -t <tag name>

List all containers:

$ docker container ls

List all images:

$ docker image ls

Stop all containers:

$ docker kill $(docker ps -q)

Remove all images:

$ docker rmi -f $(docker images -a -q)

Prune:

$ docker system prune --volumes

Stop and remove all containers

$ for i in $(docker stop $(docker ps -a -q --filter ancestor=lewis-poc/docker-ecr-workflow-node-api --format="{{.ID}}")); do docker rm $i & done

Check container log disk sizes

$ du -h $(docker inspect --format='{{.LogPath}}' $(docker ps -qa))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment