What is the best way to setup latest wordpress blog using docker?

Dream of any developer is to keep things portable and what would be more awesome thank to use Docker for your WordPress post right? I had plenty of hiccups in the setup like permission, portability, port and most annoying of all ssl compatibility.

Assuming that you have already installed docker-compose, you need a compose file as following.

version: '3.2'
    image: wordpress:5.2.0-php7.3-apache
    restart: always
        - "/etc/passwd:/etc/passwd:ro"
        - "/etc/group:/etc/group:ro"
        - ./wordpress/:/var/www/html/
        - 91:80
        - WORDPRESS_DB_PASSWORD=pass_is
        - APACHE_RUN_USER=my_user
        - APACHE_RUN_GROUP=my_group
    image: mysql:5.7
    restart: always
        - type: bind
          source: ./mysql
          target: /var/lib/mysql
        - MYSQL_ROOT_PASSWORD=pass_is

Solving the HTTPS – wordpress behind https proxy (ssl)

If you are using nginx behind https, you have to forward proto as https is

proxy_set_header X-Forwarded-Proto https;

server {
    listen 443 ssl;
    server_name yourdomain.com;
    index index.php index.html index.htm;
    ssl_trusted_certificate ./fullchain.pem;
    ssl_certificate ./fullchain.pem;
    ssl_certificate_key ./privkey.pem;
    root /usr/local/nginx/html/;
    location / {
        try_files $uri @app;
    location @app {
        proxy_set_header X-Forwarded-Proto https;
        include .common/proxy.common;

Back up your Blog.

sudo docker exec -it _mysql_1 mysqldump -uroot -ppass_id --all-databases > ./mysql-backup/backup.sql

Restore your Blog.

docker exec -i _mysql_1 mysql -uroot -ppass_id < ./backup.sql


  1. Embedded passwd and group file.
  2. Setting host user and group for folder permission.
  3. We are mounting wordpress folder so that your files can be added to git as well and you can work on wp-config.php without any issues.
  4. MySQL too will have data folder.
  5. You can easily move setup to different server in matters of mins.

Tell your network!

Why my website is responsive on desktop but not on mobile?

I just slept only to find out that I skipped a single line on a head that made my client really unhappy. Task was to make his website responsive, after all the design, forgot to add following in its head. I hope that it would save you a lot of embarrassment. You are most probably missing a viewport meta field too. You can paste following to your <head> and it should start working.

<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">


Tell your network!