This is how you can use docker compose to run WordPress on it
First make docker-compose.yml with this content
version: '2'
services:
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_DATABASE_PASSWORD}
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress_db
MYSQL_PASSWORD: ${WORDPRESS_PASSWORD}
wordpress:
image: wordpress:latest
ports:
- 5500:80
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress_db
WORDPRESS_DB_PASSWORD: ${WORDPRESS_PASSWORD}
volumes:
- /home/ubuntu/wptest/wp-content:/var/www/html/wp-content
- /home/ubuntu/wptest/php.ini:/usr/local/etc/php/conf.d/custom.ini
volumes:
db_data:
and then make custom directory at your home to store your custom setting and then load it to your docker volume
for mine i put it on my /home/ubuntu/wp-test
make php.ini file on that custom directory and put this this code
upload_max_filesize = 20M
post_max_size = 20M
make .env file on that custom directory and put this this code
MYSQL_DATABASE_PASSWORD:mysql_password
WORDPRESS_PASSWORD:wordpress_password
Discover more from Susiloharjo
Subscribe to get the latest posts sent to your email.