Docker

Setup

Commands

See what’s running:

docker ps

Container-specific:

# SSH into a running container.
docker exec -it 0061ecc7ef37 /bin/bash

# Stop
docker container stop 23642fbe8515

# Stop all
docker stop $(docker ps -a -q)

# Prune all stopped containers
docker container prune

Parameters for docker run:

  • -d: Run as daemon.
  • -p 8439:8080: Map port A externally to B internally.
  • -v ~/Documents/TiddlyWikiDockerVolume:/var/lib/tiddlywiki: Map volume A externally to B internally.
  • -e USERNAME="abc": Environment variable.
  • --restart unless-stopped: Automatically bring up the container on Docker daemon restart.

Compose:

# Assuming current directory contains a file named *docker-compose.yml*
docker-compose up

# Or
docker-compose down