簡介¶
docker-compose.yml
用來一次啟動多個images
內容¶
使用yum安装Docker-Compose¶
- yum install -y epel-release
- yum install -y python-pip
- pip install docker-compose
- docker-compose --version
使用shell安装Docker-Compose¶
- sudo curl -L "https://github.com/docker/compose/releases/download/1.23.1/docker-compose-\((uname -s)-\)(uname -m)" -o /usr/local/bin/docker-compose
- sudo chmod +x /usr/local/bin/docker-compose
- docker-compose --version
- docker-compose migrate-to-labels
一個mysql and adminer¶
# Use root/example as user/password credentials
version: '3.1'
services:
db:
image: mysql:5.7
restart: always
environment:
MYSQL_ROOT_PASSWORD: 'root'
MYSQL_DATABASE: 'db'
MYSQL_USER: 'tommy'
MYSQL_PASSWORD: 'tommy'
adminer:
image: adminer
restart: always
ports:
- 8888:8080
啟動命令( -d 可以啟動在後台 )¶
docker-compose up
adminer(UI)¶
http://localhost:8888