1. 安装(https://get.daocloud.io/)
1
2
curl -L https://get.daocloud.io/docker/compose/releases/download/1.15.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
  1. 配置文件 docker-compose.yml
1
2
3
4
5
6
7
8
9
10
wordpress:
image: wordpress
links:
- db:mysql
ports:
- 8080:80
db:
image: mariadb
environment:
MYSQL_ROOT_PASSWORD: example
  1. 启动
1
2
3
4
5
6
# 创建与启动
docker-compose up
# -f 指定配置文件名,默认docker-compose.yml

# 启动
docker-compose start
  1. 关闭
1
docker-compose stod
  1. 查询
1
docker-compose ps
  1. 删除
1
docker-compose down

本文地址 https://blog.coder4j.cn/posts/10c8507f/