web:
# build from Dockerfile
build: .
services:
web:
dns: 8.8.8.8
dns:
- 8.8.8.8
- 8.8.4.4
docker kill $(docekr ps -q )
docker stack rm stack_name
docker swarm leave
docker service scale stack_name_service_name=replicas
docker service logs stack_name service_name
docker stack services stack_name
docker service ls
services:
web:
extra_hosts:
- "somehost:192.168.1.100"
services:
web:
external_links:
- redis_1
- project_db_1:mysql
services:
web:
devices:
- "/dev/ttyUSB0:/dev/ttyUSB0"
services:
web:
labels:
com.example.description: "Accounting web app"
# build from custom Dockerfile
build:
context: ./dir
dockerfile: Dockerfile.dev
volumes:
- /var/lib/mysql
- ./_data:/var/lib/mysql
# make this service extend another
extends:
file: common.yml # optional
service: webapp
# make sure `db` is alive before starting
depends_on:
- db
# makes the `db` service available as the hostname `database`
# (implies depends_on)
links:
- db:database
- redis
# environment vars from file
env_file: .env
env_file: [.env, .development.env]
# environment vars
environment:
RACK_ENV: development
environment:
- RACK_ENV=development
# override the entrypoint
entrypoint: /app/start.sh
entrypoint: [php, -d, vendor/bin/phpunit]
# command to execute
command: bundle exec thin -p 3000
command: [bundle, exec, thin, -p, 3000]
# expose ports to linked services (not to host)
expose: ["3000"]
# build from image
image: ubuntu
image: ubuntu:14.04
image: tutum/influxdb
image: example-registry:4000/postgresql
image: a4bc65fd
docker-compose build