1 mkdir my_wordpress 2 cd my_wordpress
1 touch docker-compose.yml;vi docker-compose.yml
添加以下內容:mysql
1 version: '3.3' 2 3 services: 4 db: 5 image: mysql:5.7 6 volumes: 7 - dbdata:/var/lib/mysql 8 restart: always 9 environment: 10 MYSQL_ROOT_PASSWORD: somewordpress 11 MYSQL_DATABASE: wordpress 12 MYSQL_USER: wordpress 13 MYSQL_PASSWORD: wordpress 14 15 wordpress: 16 depends_on: 17 - db 18 image: wordpress:latest 19 ports: 20 - "8000:80" 21 restart: always 22 environment: 23 WORDPRESS_DB_HOST: db:3306 24 WORDPRESS_DB_USER: wordpress 25 WORDPRESS_DB_PASSWORD: wordpress 26 volumes: 27 dbdata:
1 docker-compose up -d