Docker Compose cheat sheet

Basic config example

# docker-compose.yml
version: '3'

services:
  web:
    build: .
    # build from Dockerfile
    context: ./Path
    dockerfile: Dockerfile
    ports:
     - "5000:5000"
    volumes:
     - .:/code
  redis:
    image: redis

Common commands

Config file reference

Building

Ports

Commands

Environment variables

Dependencies

Other options

Advanced features

Labels

DNS servers

Devices

Hosts

Network

External network

.

.

.

----

https://gist.github.com/jonlabelle/bd667a97666ecda7bbc4f1cc9446d43a

https://devhints.io/docker-compose

.

Last updated

Was this helpful?