Skip to content

Instantly share code, notes, and snippets.

@theothermattm
Created December 6, 2019 16:02
Show Gist options
  • Save theothermattm/66f104d8632ca53b9078e084738b0839 to your computer and use it in GitHub Desktop.
Save theothermattm/66f104d8632ca53b9078e084738b0839 to your computer and use it in GitHub Desktop.
docker-compose command cheatsheet

build everything in the docker-compose.yaml file

docker-compose build

build just one service in docker-compose.yaml file

docker-compose build myservice

run everything in the docker-compose.yaml file

docker-compose up

if you want to run the container in the background (no console output), do this (-d is 'daemon' or background mode):

docker-compose up -d

run one thing in the docker-compose file

docker-compose up myservice

attach to a running service, assuming bash is in the container (will need a new terminal window unless you ran the services in daemon mode)

docker-compose exec myservice /bin/bash

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