Skip to content

Instantly share code, notes, and snippets.

@janstuemmel
Last active September 1, 2017 14:57
Show Gist options
  • Save janstuemmel/cb7db8ad728a66f3fa2e4b021283d156 to your computer and use it in GitHub Desktop.
Save janstuemmel/cb7db8ad728a66f3fa2e4b021283d156 to your computer and use it in GitHub Desktop.
Docker Cheatsheet

Docker Cheatsheet

A cheatsheet with basic docker and docker-compose commands

Docker

exec

  • docker exec -it <nam> /bin/bash attach interactive tty to the running image

run

  • docker run <name> --rm remove after creation
docker run --rm --name test_container \
  -e FOO=1 \
  -p "8080:80" \
  -v ".:/srv/app" \
  namespace/image_name:version

Compose

start

  • docker-compose up [service] Starts a service or all services
  • docker-compose ps Lists all running or paused services
  • docker-compose exec [service] /bin/bash Executes a command on a running service
  • docker-compose run --rm [service] echo foo Executes a single command on a service

YML

create a docker-compose.yml

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