Skip to content

Instantly share code, notes, and snippets.

@wsilva
Last active February 28, 2021 03:44
Show Gist options
  • Save wsilva/d6f3db31dfeafb98426f34be134f472b to your computer and use it in GitHub Desktop.
Save wsilva/d6f3db31dfeafb98426f34be134f472b to your computer and use it in GitHub Desktop.
Snippet Docker Compose version 2
<!-- colocar esse snippet em %SUBLIMEINSTALLPATH%/Packages/docker-compose/docker-compose-template-v2.sublime-snippet -->
<snippet>
<content><![CDATA[
version: '2'
services:
web:
build: ./dir
container_name: my-web-container
links:
- db
- db:database
external_links:
- redis_1
- project_db_1:mysql
- project_db_1:postgresql
depends_on:
- db
command: [bundle, exec, thin, -p, 3000]
dns: 8.8.8.8
dns:
- 8.8.8.8
- 9.9.9.9
dns_search: example.com
dns_search:
- dc1.example.com
- dc2.example.com
tmpfs: /run
tmpfs:
- /run
- /tmp
entrypoint: /code/entrypoint.sh
entrypoint:
- php
- -d
- zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so
- -d
- memory_limit=-1
- vendor/bin/phpunit
env_file: .env
env_file:
- ./common.env
- ./apps/web.env
- /opt/secrets.env
environment:
RACK_ENV: development
SHOW: 'true'
SESSION_SECRET:
environment:
- RACK_ENV=development
- SHOW=true
- SESSION_SECRET
expose:
- "3000"
- "8000"
ports:
- "443:443"
- "9001-9100:8001-8100"
extra_hosts:
- "somehost:162.242.195.82"
- "otherhost:50.31.209.229"
logging:
driver: syslog
options:
syslog-address: "tcp://192.168.0.42:123"
labels:
com.example.description: "Accounting webapp"
com.example.department: "Finance"
com.example.label-with-empty-value: ""
labels:
- "com.example.description=Accounting webapp"
- "com.example.department=Finance"
- "com.example.label-with-empty-value"
networks:
- new
volumes:
- /var/lib/mysql
- /opt/data:/var/lib/mysql
- ./cache:/tmp/cache
- ~/configs:/etc/configs/:ro
- datavolume:/var/lib/mysql
volume_driver: mydriver
volumes_from:
- service_name
- service_name:ro
- container:container_name
- container:container_name:rw
cpu_shares: 73
cpu_quota: 50000
cpuset: 0,1
user: www-data
working_dir: /code
domainname: foo.com
hostname: foo
ipc: host
mac_address: 02:42:ac:11:65:43
mem_limit: 1000000000
memswap_limit: 2000000000
privileged: true
restart: always
read_only: true
shm_size: 64M
stdin_open: true
tty: true
worker:
build:
context: ./worker
dockerfile: Dockerfile-alternative
args:
buildnum: 3
image: user/worker:tag
networks:
- legacy
- outside
- default
db:
image: mysql
networks:
new:
aliases:
- database
- db1
legacy:
aliases:
- mysql
detailed:
ipv4_address: 172.16.238.10
ipv6_address: 2001:3984:3989::10
networks:
new:
legacy:
detailed:
driver: bridge
driver_opts:
com.docker.network.enable_ipv6: "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
outside:
external: true
volumes:
datavolume:
external: true
data:
external:
name: actual-name-of-volume
]]></content>
<!-- Optional: Tab trigger to activate the snippet -->
<tabTrigger>dcom2</tabTrigger>
<!-- Optional: Scope the tab trigger will be active in -->
<scope>source.yaml</scope>
<!-- Optional: Description to show in the menu -->
<description>Docker Compose version 2</description>
</snippet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment