Skip to content

Instantly share code, notes, and snippets.

@stephen-hannam
Last active August 3, 2020 23:53
Show Gist options
  • Save stephen-hannam/b7325b3c544e9d11d85e07727b5b6847 to your computer and use it in GitHub Desktop.
Save stephen-hannam/b7325b3c544e9d11d85e07727b5b6847 to your computer and use it in GitHub Desktop.
Docker 1 liners

Dockery do

remove all containers

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

remove all images

$docker rmi $(docker images -q)

remove all images forcefully

$docker rmi $(docker images -q) --force

docker run:

--> use -t to get errors if run fails --> -d detach/daemon --> -i keeps STDIN open --> -e to pass in env vars --> -p exposed ports to map to external ports

docker ps: # list containers

--> -a all, incl stopped/exited

pass .env file in it run-time:

--> docker run -it -v pwd/configs:/app/configs -p xxxx:xxxx image_name

mount volume

-v ext_path:int_path

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