Last modified on 21 Aug 2020.

In this note, I wanna an automatical setting up of basic things.

👉 Install Docker by following this note.

WP basic without backup

Make a folder name mysite containing,

|-- docker-compose.yml  # main file
|-- backup              # contains backup files using AIO WP Migration plugins
|-- plugins             # contains plugins
|-- themes              # contains templates
|-- wordpress           # main site's sources

In the docker-compose.yml,

version: '3.1'


    image: wordpress
    restart: always
        - 8080:80
        WORDPRESS_DB_USER: exampleuser
        WORDPRESS_DB_PASSWORD: examplepass
        WORDPRESS_DB_NAME: exampledb
        - './html/:/var/www/html/'
        - './plugins/:/var/www/html/wp-content/plugins/'
        - './themes/<theme>/:/var/www/html/wp-content/themes/<theme>'

    image: mysql:5.7
    restart: always
        MYSQL_DATABASE: exampledb
        MYSQL_USER: exampleuser
        MYSQL_PASSWORD: examplepass

Start the container,

cd mysite
docker-compose up -d
# check running containers
docker ps -a

Browse http://localhost:8080 to install wordpress by gui.


In the case you wanna see the list of users or access to the mysql environement,

# connect to MySQL running container
docker exec -it <container_db> bash

# connect to mysql database
mysql -u wordpress -p

# list all users
SELECT host, user FROM mysql.user;

Install WP-CLI

# Download wp-cli
curl -O
# Make it executable
chmod +x wp-cli.phar
# Move it into /usr/local/bin/wp
sudo mv wp-cli.phar /usr/local/bin/wp
# Check whether the installation worked
wp --info

For example, activate all-in-one-wp-migration (already copied / placed in folder plugins)

wp plugin activate all-in-one-wp-migration --allow-root

Errors & warnings

apache2: Could not reliably determine the server's fully qualified domain name
# enter to wordpress container's bash
docker exec -it <container> bash
# add
echo 'ServerName localhost' >> /etc/apache2/apache2.conf
# restart apache/container
service apache2 restart
Could not create directory on mounted volume
# enter to wordpress container's bash
docker exec -it <container> bash
# then
chown -R www-data:www-data /var/www
Your file exceeds the maximum upload size for this site: 2 MB
# .htaccess
php_value upload_max_filesize 400M
php_value post_max_size 400M
# php_value memory_limit 256M
# php_value max_execution_time 300
# php_value max_input_time 300


Notes with this notation aren't good enough. They are being updated. If you can see this, you are so smart. ;)