clear
cd
mkdir wp
cd wp
nano docker-compose.yml
# docker-compose.yaml
version: "3.8"
services:
database:
image: mysql:5.7
volumes:
- database_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: mypassword
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
wordpress:
image: wordpress:latest
depends_on:
- database
ports:
- 8080:80
restart: always
environment:
WORDPRESS_DB_HOST: database:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
volumes:
- wordpress_plugins:/var/www/html/wp-content/plugins
- wordpress_themes:/var/www/html/wp-content/themes
- wordpress_uploads:/var/www/html/wp-content/uploads
volumes:
database_data:
wordpress_plugins:
wordpress_themes:
wordpress_uploads: