Skip to content

Instantly share code, notes, and snippets.

@jasdeepkhalsa
Last active December 8, 2021 21:16
Show Gist options
  • Save jasdeepkhalsa/8581bb3f0b3b0f4d88a70720029044e9 to your computer and use it in GitHub Desktop.
Save jasdeepkhalsa/8581bb3f0b3b0f4d88a70720029044e9 to your computer and use it in GitHub Desktop.
Docker power commands
# Stop all containers
docker stop $(docker ps -q)
# Remove all containers
docker rm $(docker ps -aq)
# Remove all images
docker rmi $(docker images -aq)
# See logs of a container
docker logs -f <container id>
# Inspect metadata of a container
docker inspect <container id> format='{{.IPAddress}}{{end}}'
# Enter into bash of a container
docker exec -it <container id> bash
# Pull a docker image from DockerHub
docker pull selenium/standalone-chrome:96.0
# Rename (tag) a docker image to a new one
docker image tag selenium/standalone-chrome:96.0 my-account/selenium-chrome:96
docker image tag selenium/standalone-chrome:96.0 my-account/selenium-chrome:latest
# Remove previous tag
docker rmi selenium
# Push image to a remote repository
docker login
docker push my-account/selenium-chrome:96
docker push my-account/selenium-chrome:latest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment