Skip to content

Instantly share code, notes, and snippets.

@yavgel85
Last active November 25, 2021 16:15
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 yavgel85/7d93ee86bf1b14b3d7cb4db4d996b15b to your computer and use it in GitHub Desktop.
Save yavgel85/7d93ee86bf1b14b3d7cb4db4d996b15b to your computer and use it in GitHub Desktop.
Docker and docker-compose commands #docker #command

Docker Compose

start the containers (in detached mode)
docker-compose up -d 
start and build containers
docker-compose up -d --build 
stop containers
docker-compose stop 
get a list of services
docker-compose ps --services 
start interactive bash shell in a service
docker-compose exec SERVICE_NAME 
run a command in a service tha isnt running
docker-compose run SERVICE_NAME COMMAND_NAME 

Docker

list all containers (including stopped)
docker ps -a 
remove all containers (stop if running)
docker container rm -f $(docker container ls -a -q) 
remove all images (stop if running)
docker image rm -f $(docker image ls -a -q)

Docker Sync

install unison (OSX)
docker logout && brew install unison 
start docker-sync
docker-sync-stack start 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment