Be Your Own Cloud code · PART 2 — FOUNDATION

Chapter 6 Docker and Compose from Zero

4 blocks · pp. 29–30 in the paperback

Going further than the chapter: Docker and Compose, Properly Installed

Installing Docker

# p. 29

Run Terminal, on the server
curl -fsSL https://get.docker.com | sh
sudo usermod -aG docker $USER
# Log out and back in for the group change to apply, then verify:
docker run hello-world

The Folder Convention This Whole Book Uses

# p. 30

Reference Folder layout — for reference, not to paste
/opt/stacks/
  vaultwarden/
    docker-compose.yml
    .env
    data/
  nextcloud/
    docker-compose.yml
    .env
  pihole/
    docker-compose.yml
    .env

# p. 30

Run Terminal, on the server
sudo mkdir -p /opt/stacks
sudo chown $USER:$USER /opt/stacks

The Commands You'll Actually Use

# p. 30

Run Terminal, inside a service's folder
# start in the background
docker compose up -d
# follow the logs — your first stop when something's wrong
docker compose logs -f
# fetch newer versions of your pinned images
docker compose pull
# stop and remove containers (data in volumes survives this)
docker compose down
# what's actually running right now
docker compose ps

Reproduced exactly from Be Your Own Cloud, Chapter 6. The book explains what each line does and what to do when it doesn't work. About the book

Something here not working as the book describes? Tell the author.