Skip to content

Instantly share code, notes, and snippets.

@asmega
Last active May 19, 2021 16:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asmega/ca12594f47c2f77ab60c6dfe54ce83ee to your computer and use it in GitHub Desktop.
Save asmega/ca12594f47c2f77ab60c6dfe54ce83ee to your computer and use it in GitHub Desktop.
docker

docker

Delete all containers

docker rm container $(docker ps -a -q)

Delete all images

docker rmi $(docker images -q)

IP of container

docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' CONTAINER_ID

bash shell

docker exec -it CONTAINER_ID /bin/bash

start docker image with port forwarding between host and container

docker run -p 3000:3000 IMAGE_ID

run docker image for debugging

docker run --rm -it IMAGE_ID

docker-compose

service="web"
docker-compose run $service /bin/bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment