Docker Compose

CLI

 docker-compose up           # start docker-compose.yml from current dir
 docker-compose down

Custom Network Config

Examples from compose documentation

Network

To assign a network a fixed CIDR range

networks:
  app_net:                                   # <-- any name goes here
    driver: bridge
    enable_eripv6: true
    ipam:
      driver: default
      config:
        - subnet: 172.16.238.0/24
          gateway: 172.16.238.1
        - subnet: 2001:3984:3989::/64        
          gateway: 2001:3984:3989::1

To make a service use it

Service

To assign a service a fixed IP

Setup Troubleshooting

Couldn’t connect to Docker daemon at http+docker://localhost - is it running?

Ensure systemd unit is configured correctly and has TCP socket configured. If not edit with sudo systemctl edit docker.service and provide

Also set env var DOCKER_HOST

Last updated

Was this helpful?