Skip to content

Latest commit

 

History

History
47 lines (34 loc) · 796 Bytes

docker.md

File metadata and controls

47 lines (34 loc) · 796 Bytes

Docker

Suspend all running containers

docker kill $(docker ps -q)

Remove all containers

docker rm $(docker ps -a -q)

Remove all images

docker images -q | xargs docker rmi

Login via SSH

docker exec -i -t <container_id> bash

Docker Compose

Run a container

docker-compose -f docker-compose-dev.yml run -d --service-ports --rm --no-deps api npm start
  • -d - Detached mode: Run container in the background
  • -rm - Remove container after run. Ignored in detached mode
  • --no-deps - Don't start linked services
  • --service-ports - Run command with the service's ports enabled and mapped to the host

Restart a container

docker-compose restart api

Kill a container

docker-compose kill api