Install WordPress using Docker

Using images provided by Bitnami

Since the wordpress deploy pack described here is no longer provided, I am trying to use Docker image still provided by Bitnami. Don't ask why, just a habit.

So, install docker-ce and docker-compose first. Please refer Docker offical manual.

For docker-compose:

sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

sudo chmod +x /usr/local/bin/docker-compose

docker-compose --version

To upgrade docker-compose, run commands above again to override the execludable file.

Then, run the docker image as Bitnami docs instructed:

curl -sSL https://raw.githubusercontent.com/bitnami/containers/main/bitnami/wordpress/docker-compose.yml > docker-compose.yml
docker-compose up -d

Then mostly done. Edit the docker-compose.yml file, usually the environment variables to initialize your site properly. Note that there will also a mariadb image to be started, so here's the doc.


Some commands might help:

docker ps -a
docker volume -ls

WordPress offical image

Then I tried WordPress offical image. Almost the same. Refer here. I find it's easy to use docker-compose to start a container.


And more

When I'm tring to upload photos to media, there's an error saying that the max uploading limit is 2M. Come on, it's 2023 now, what image quality a 2M picture is.

So, into the container: docker exec -it $container_ID /bin/bash

And there's 2 way to solve it:

  • Edit /var/www/html/.htaccess and add following lines into it:
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value memory_limit 256M
  • Edit the php.ini, but find it first...and add:
upload_max_filesize = 128M
post_max_size = 128M
memory_limit = 512M

I newed a php.ini file in /usr/local/etc/php/conf.d/. Your route may not be the same. Or should be for it´s the WordPress offical image.