Skip to content

Instantly share code, notes, and snippets.

@PhilipSchmid
Created August 13, 2018 15:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PhilipSchmid/5d01af81f2d584da64abb3610d532720 to your computer and use it in GitHub Desktop.
Save PhilipSchmid/5d01af81f2d584da64abb3610d532720 to your computer and use it in GitHub Desktop.
docker-compose.yml template which covers most of the configurations which are used from time to time
version: "3.7"
services:
backend:
image: registry.example.com/my-example-docker-image:stable
restart: always
hostname: my-example-service.example.com
environment:
TZ: Europe/Zurich
env_file:
- backend.env
healthcheck:
test: ["CMD-SHELL", "curl --fail http://localhost:$${BACKEND_PORT} || exit 1"]
interval: 30s
timeout: 10s
retries: 3
extra_hosts:
- ${ALTERNATIVE_HOSTNAME}:127.0.0.1
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- type: volume
source: long-volume-syntax-example
target: /opt/data
logging:
driver: fluentd
options:
fluentd-async-connect: 'true'
fluentd-buffer-limit: 10MB
fluentd-max-retries: '30'
fluentd-address: fluentd.example.com:24224
networks:
internal:
ipv4_address: 172.16.1.10
svc_transit:
labels:
traefik.port: 80
traefik.frontend.rule: Host:my-example-service.example.com
traefik.docker.network: svc_transit
traefik.protocol: http
volumes:
long-volume-syntax-example:
driver_opts:
type: "nfs4"
o: "addr=192.168.1.10,nolock,soft,rw"
device: ":/nfs/my-example-nfs-share"
networks:
internal:
internal: true
driver: bridge
ipam:
driver: default
config:
- subnet: 172.16.1.0/24
svc_transit:
external: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment