李明
|
docker-compose文件
cd labs/ cd wordpress/ more docker-compose.yml 复制代码
version: '3' services: web: image: wordpress ports: - 8080:80 environment: WORDPRESS_DB_HOST: mysql WORDPRESS_DB_PASSWORD: root networks: - my-network depends_on: - mysql deploy: mode: replicated replicas: 3 restart_policy: condition: on-failure delay: 5s max_attempts: 3 update_config: parallelism: 1 delay: 10s mysql: image: mysql environment: MYSQL_ROOT_PASSWORD: root MYSQL_DATABASE: wordpress volumes: - mysql-data:/var/lib/mysql networks: - my-network deploy: mode: global placement: constraints: - node.role == manager volumes: mysql-data: networks: my-network: driver: overlay 复制代码 docker-stack 部署
#了解docker stack基本命令 docker stack 复制代码 docker stack deploy wordpress --compose-file=docker-compose.yml docker stack ps wordpress docker stack services wordpress 复制代码 PS:docker-stack 就是通过yml类似docker-compose的文件来进行多机的部署。
|
2018-10-03 21:44:30