Skip to content

Instantly share code, notes, and snippets.

@wilmoore
Last active August 15, 2022 13:54
Show Gist options
  • Save wilmoore/dae8b49a060f3b9f5cf0df6c3cdc5909 to your computer and use it in GitHub Desktop.
Save wilmoore/dae8b49a060f3b9f5cf0df6c3cdc5909 to your computer and use it in GitHub Desktop.
Income Sources :: Cheatsheets :: Docker for Developers Cheatsheet

Income Sources :: Cheatsheets :: Docker for Developers Cheatsheet

⪼ Made with 💜 by realpolyglot.dev

Docker Cheatsheet

Build & Run
⪼ open -a Docker
⪼ docker compose build && docker compose up
⪼ open 'http://app.local:5000'
Run Arbitrary Commands & Scripts via Container's Shell
⪼ docker ps -a --format "table {{.ID}}\t{{.Names}}\t{{.Ports}}"
CONTAINER ID   NAMES                           PORTS
6769e8809d82   web_1                           0.0.0.0:5000->5000/tcp, :::5000->5000/tcp

⪼ docker exec -it web_1 /bin/bash

Debug

List of Containers by ID
ɗ⩭⪼ docker ps -a --format "table {{.ID}}\t{{.Names}}\t{{.Ports}}"

CONTAINER ID   NAMES                           PORTS
9c0dfa183bb5   vue-http_1
5029c10aff07   que_1
87bb7c61daed   web_1
135aff8b5edd   que_1
cb8a4c3637df   rdbms_1
041c665663cd   red_1
37eab2ad0e64   docker-tutorial                 0.0.0.0:80->80/tcp, :::80->80/tcp
Stop Containers
ɗ⩭⪼ docker system prune
WARNING! This will remove:
  - all stopped containers
  - all networks not used by at least one container
  - all dangling images
  - all dangling build cache

Are you sure you want to continue? [y/N] y
Deleted Containers:
...

Deleted Networks:
default

Deleted Images:
deleted: sha256:...

Deleted build cache objects:
...

Total reclaimed space: 573.3MB
~

References

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