Настройка MySQL и phpMyAdmin:
version: '3.7'
services:
#Database
db:
image: mysql:latest
volumes:
- db_data:/var/lib/mysql
ports:
- "1207:3306"
restart: always
container_name: my_wordpress_db
environment:
MYSQL_ROOT_PASSWORD: password
#phpMyAdmin
phpmyadmin:
depends_on:
- db
image: phpmyadmin/phpmyadmin
restart: always
container_name: my_wordpress_phpmyadmin
ports:
- "8080:80"
environment:
PMA_HOST: db:3306
MYSQL_ROOT_PASSWORD: password
volumes:
db_data:
networks:
default:
external:
name: my_wordpress_network
Настройка среды WordPress docker:
version: '3.7'
services:
#Wordpress
wordpress:
image: wordpress:latest
external_links:
- my_wordpress_db:db
volumes: ['./:/var/www/html']
ports:
- "33003:80"
restart: always
container_name: my_project_container
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: root
WORDPRESS_DB_PASSWORD: password
WORDPRESS_DB_NAME: my_project_db
networks:
default:
external:
name: my_wordpress_network