$ pip install docker-compose
$ docker-compose --version
docker-compose version 1.25.5, build unknown
version: '3' # yaml的版本
services:
app:
image: cutejaneii/my_api:june2020 # 映像檔
volumes:
- /var/lib/docker/volumes/volume_nfs/_data:/nfs # volume
ports:
- 8801:8801 # PORT MAPPING
restart: always # 啟動POLICY
environment: # 環境變數
- API_CASSANDRA_CONTACT_POINTS=192.168.95.1,192.168.95.2
- API_CASSANDRA_KEY_SPACE=my_keyspace
- API_NAME=my_api
volumes:
volume_nfs:
version: '3'
services:
web:
build: .
ports:
- "5000:5000"
volumes:
- .:/code
environment:
FLASK_ENV: development
redis:
image: "redis:alpine"
$ docker-compose -f docker-compose.yml up
$ docker-compose -d docker-compose.yml up