编写/root/wordpress/docker-compose.yaml文件,具体要求如下: (1)容器名称:wordpress;镜像:wordpress:latest;端口映射:82:80; (2)容器名称:mysql;镜像:mysql:5.6; (3)MySQL root用户密码:123456; (4)创建数据库wordpress。
时间: 2023-03-28 17:01:32 浏览: 133
docker容器的MySQL镜像文件
version: '3'
services:
wordpress:
container_name: wordpress
image: wordpress:latest
ports:
- "82:80"
depends_on:
- mysql
restart: always
environment:
WORDPRESS_DB_HOST: mysql
WORDPRESS_DB_USER: root
WORDPRESS_DB_PASSWORD: 123456
WORDPRESS_DB_NAME: wordpress
mysql:
container_name: mysql
image: mysql:5.6
restart: always
environment:
MYSQL_ROOT_PASSWORD: 123456
volumes:
- ./mysql_data:/var/lib/mysql
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
ports:
- "3306:3306"
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
interval: 10s
timeout: 5s
retries: 3
networks:
- backend
networks:
backend:
driver: bridge
以上是/root/wordpress/docker-compose.yaml文件的内容,已按照要求编写。
阅读全文