Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Docker Compose FIle For Wordpress, MySQL & phpmyadmin

Wordpress & Docker

This file will setup Wordpress, MySQL & PHPMyAdmin with a single command. Add the code below to a file called "docker-compose.yaml" and run the command

$ docker-compose up -d

# To Tear Down
$ docker-compose down --volumes
version: '3'

services:
  # Database
  db:
    image: mysql:5.7
    volumes:
      - db_data:/var/lib/mysql
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: password
      MYSQL_DATABASE: wordpress
      MYSQL_USER: wordpress
      MYSQL_PASSWORD: wordpress
    networks:
      - wpsite
  # phpmyadmin
  phpmyadmin:
    depends_on:
      - db
    image: phpmyadmin/phpmyadmin
    restart: always
    ports:
      - '8080:80'
    environment:
      PMA_HOST: db
      MYSQL_ROOT_PASSWORD: password 
    networks:
      - wpsite
  # Wordpress
  wordpress:
    depends_on:
      - db
    image: wordpress:latest
    ports:
      - '8000:80'
    restart: always
    volumes: ['./:/var/www/html']
    environment:
      WORDPRESS_DB_HOST: db:3306
      WORDPRESS_DB_USER: wordpress
      WORDPRESS_DB_PASSWORD: wordpress
    networks:
      - wpsite
networks:
  wpsite:
volumes:
  db_data:
@petercr

This comment has been minimized.

Copy link

@petercr petercr commented Jan 22, 2019

Cool I can't wait to try this one out. Sounds better than setting up XAMPP and then WordPress just to make a site.
Thanks 😄 👍

@bknightly

This comment has been minimized.

Copy link

@bknightly bknightly commented Jan 25, 2019

Big thanks @bradtraversy, this did the trick!

@adityakmr7

This comment has been minimized.

Copy link

@adityakmr7 adityakmr7 commented Feb 11, 2019

how can i start this. as i have composed it but it is not accessible to localhost:8000.

@ghost

This comment has been minimized.

Copy link

@ghost ghost commented Feb 14, 2019

how can i start this. as i have composed it but it is not accessible to localhost:8000.

You should after you installed Docker Compose. Then create a docker-compose.yml file. Copy the content from the above Gist file and paste them there. Run docker-compose up -d and wait until everything is completed. Then go to 127.0.0.1:8000.

@clissmancamacho

This comment has been minimized.

Copy link

@clissmancamacho clissmancamacho commented Feb 17, 2019

Thanks Brad! You are wonderfull!

@steffik02

This comment has been minimized.

Copy link

@steffik02 steffik02 commented Feb 20, 2019

how can i start this. as i have composed it but it is not accessible to localhost:8000.

I had the same problem. I had to run docker-machine ip to get the IP address, then instead of localhost:8000, I used <docker.ip.here>:8000

@david-j-davis

This comment has been minimized.

Copy link

@david-j-davis david-j-davis commented Mar 1, 2019

No matter what setup I use, I cannot get localhost:8000 or to work. I've tried several tutorials for wordpress with docker, and every time I get ERR_CONNECTION_REFUSED. I don't get what the issue is. My docker log error is: Access denied for user 'wordpress'@'172.18.0.3' (using password: YES) and I've followed along with this tutorial exactly.

@galvakojis

This comment has been minimized.

Copy link

@galvakojis galvakojis commented Mar 4, 2019

@david-j-davis

No matter what setup I use, I cannot get localhost:8000 or to work. I've tried several tutorials for wordpress with docker, and every time I get ERR_CONNECTION_REFUSED. I don't get what the issue is. My docker log error is: Access denied for user 'wordpress'@'172.18.0.3' (using password: YES) and I've followed along with this tutorial exactly.

If this will not work i post full yml file


# Wordpress
    environment:
      WORDPRESS_DB_HOST: db:3306
      WORDPRESS_DB_USER: wordpress
      WORDPRESS_DB_PASSWORD: wordpress

# phpmyadmin
    environment:
      PMA_HOST: db
      MYSQL_ROOT_PASSWORD: password
      MYSQL_USER: wordpress
      MYSQL_PASSWORD: wordpress

# Database
    environment:
      MYSQL_DATABASE: wordpress
      MYSQL_ROOT_PASSWORD: password
      MYSQL_USER: wordpress
      MYSQL_PASSWORD: wordpress
@devzons

This comment has been minimized.

Copy link

@devzons devzons commented Mar 22, 2019

It already used by the other app. just change 8000 to 8800(or some other number). It works for me. Let me know if I'm wrong. Thanks

@vulcan25

This comment has been minimized.

Copy link

@vulcan25 vulcan25 commented Mar 29, 2019

@bradtraversy This gist uses two different methods of mounting a volume.

The db service defines a named volume db_data, which sits on the host at/var/lib/docker/volumes.

However the wordpress service defines a host path, which is actually mounting the current directory on the host, which is where the compose file (with credentials) likely is:

volumes: ['./:/var/www/html']

If you save this gist as docker-compose.yml and run docker compose up the compose file allows itself to be downloaded by anyone at: http://localhost:8000/docker-compose.yml.

For more info: compose volume docs. Unless I'm missing something, this should really be updated so that the wordpress volume is defined in a similar manner to db_data.

@burkaslarry

This comment has been minimized.

Copy link

@burkaslarry burkaslarry commented Mar 30, 2019

If I want to deploy to heroku or other web hosting, how do i change my database configuration so that No error in establishing the database connection?

@tbanys

This comment has been minimized.

Copy link

@tbanys tbanys commented Apr 27, 2019

Just be careful with docker-compose down --volumes when you tear down the container. --volumes part will delete database and files of your project. Use docker-compose down without --volumes, then you won't lose files and data.

@Waka867

This comment has been minimized.

Copy link

@Waka867 Waka867 commented May 20, 2019

Thanks! @bradtraversy

@SipTech

This comment has been minimized.

Copy link

@SipTech SipTech commented May 21, 2019

Thank you @bradtraversy

I also want to add that if you want to spin up mysql from backups/dumps you can use following:

  # Database
  db:
    image: mysql:5.7
    volumes:
      - ./mysql-dump:/docker-entrypoint-initdb.d
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: password
      MYSQL_DATABASE: your_db
      MYSQL_USER: your_user
      MYSQL_PASSWORD: your_password
    networks:

Use mysql-dump to export you data into a self contained backup.sql file.
Create a folder in your project directory, save your backup.sql file(s) there.
When docker-compose runs it will restore your databases in the mysql container.

@SipTech

This comment has been minimized.

Copy link

@SipTech SipTech commented May 23, 2019

@bradtraversy how do I shutdown/restart docker without losing my data?

@zoechi

This comment has been minimized.

Copy link

@zoechi zoechi commented Jun 17, 2019

@SipTech add

    volumes:
      - ./db_data:/var/lib/mysql

to db:
Then the Database will be created on the local file system in ./db_data.
You can use docker cp ... to copy files from the Docker volume to the local directory (before you add above code to docker-compose.yml).

@delriodev

This comment has been minimized.

Copy link

@delriodev delriodev commented Jul 8, 2019

Hello! I'm new to programming!

I also had the problem described above: localhost:8000 doesn't work, so I did <docker.ip.here>:8000 like @steffik02 said and it worked

Then, inside wp-admin, I had trouble with plug in installation because of FTP permission. The solution was to add the following to my wp-config.php file :

define( 'FS_METHOD', 'direct');

But now, when I try to install a plugin I get: "Installation failed: Could not create directory."

I ran a similar project in an ubuntu VM and it worked perfectly,
I am now using a Mac and I'm having all these problems

@tdse13

This comment has been minimized.

Copy link

@tdse13 tdse13 commented Jul 12, 2019

One question: how to update the container? Does Watchtower work? Thank you.

@paultofunmi

This comment has been minimized.

Copy link

@paultofunmi paultofunmi commented Aug 24, 2019

Hi, can someone help with the Dockerfile.

@Ashleybrandon

This comment has been minimized.

Copy link

@Ashleybrandon Ashleybrandon commented Aug 29, 2019

Can you use this method to set up multiple wordpress instances locally?

@goodguy000

This comment has been minimized.

Copy link

@goodguy000 goodguy000 commented Oct 7, 2019

Can you use this method to set up multiple wordpress instances locally?

docker compose 1: use wordpress port: 8000, phpadmin: 8080, network: wpsite
docker compose 2: use wordpress port: 8001, phpadmin: 8081, network: wpsite1

@zeitgeist2018

This comment has been minimized.

Copy link

@zeitgeist2018 zeitgeist2018 commented Oct 9, 2019

This just works out of the box. Many thanks for your collaboration to the community, we really appreciate your labor!

@sharker92

This comment has been minimized.

Copy link

@sharker92 sharker92 commented Oct 23, 2019

hey, why you use square brackets and single quotes here: volumes: ['./:/var/www/html']?

@kelwinsj

This comment has been minimized.

Copy link

@kelwinsj kelwinsj commented Oct 27, 2019

Works like a charm. Thank you Brad.

@vulcan25

This comment has been minimized.

Copy link

@vulcan25 vulcan25 commented Nov 4, 2019

@sharker92 see my earlier comment, this is VULNERABLE if deployed in its current form

Anyone who deploys this straight into production is making the compose file accessible at example.com/docker-compose.yml along with the db credentials, unless you take steps to prevent this.

@trung1704ptit

This comment has been minimized.

Copy link

@trung1704ptit trung1704ptit commented Nov 6, 2019

Hi everyone, How can we backup wordpress by using this docker compose.
I tried to backup by using plugin, but when restore it take too long for response, something still loading.
Anyone have solution, please help me

@krisnagunarno

This comment has been minimized.

Copy link

@krisnagunarno krisnagunarno commented Nov 28, 2019

Hello everyone, I've a trouble to make this kind of docker compose when I try to make the credentials "stored"(or encrypted? I don't really understand) in docker secret. Any solutions?

@guidosantillan01

This comment has been minimized.

Copy link

@guidosantillan01 guidosantillan01 commented Dec 10, 2019

Hi everyone! I am having a problem when I want to install the plugins. Everything else seems to be ok.

image

Did anyone have the same error?

@shahabbukhari

This comment has been minimized.

Copy link

@shahabbukhari shahabbukhari commented Jan 14, 2020

I'm getting an "Error establishing a connection to database" when I browse to localhost:8000.
Help

@Alhamou

This comment has been minimized.

Copy link

@Alhamou Alhamou commented Jan 14, 2020

thank you pro, keep coning :)

@edrichmkhasi

This comment has been minimized.

Copy link

@edrichmkhasi edrichmkhasi commented Jan 16, 2020

hi.

i'm working on a project where i'm using mongoDB as my database and nodejs.... i'm trying to create a docker image and connect to my project.... but it keeps giving me an error (/usr/local/bin/docker-entrypoint.sh: 8: exec: .: Permission denied) please help

@priscilalima

This comment has been minimized.

Copy link

@priscilalima priscilalima commented Jan 23, 2020

Hi, thank you so much for the code. How can I access phpmyadmin through the url?

@christianfroehlichconsulting

This comment has been minimized.

Copy link

@christianfroehlichconsulting christianfroehlichconsulting commented Feb 4, 2020

Hi, thank you so much for the code. How can I access phpmyadmin through the url?

I would like to know too. :)

@anionDev

This comment has been minimized.

Copy link

@anionDev anionDev commented Feb 16, 2020

this is a very useful file. thank you!

@ghost

This comment has been minimized.

Copy link

@ghost ghost commented Feb 17, 2020

Hi all, if you get database connection error, just add WORDPRESS_DB_NAME: wordpress in wordpress section.

@luisgjb

This comment has been minimized.

Copy link

@luisgjb luisgjb commented Feb 26, 2020

Also if someone is having issues to connect this link could help docker-library/mysql#51 (comment)

@HeadStudios

This comment has been minimized.

Copy link

@HeadStudios HeadStudios commented Mar 28, 2020

Wow - this is very cool - and much cleaner than using MAMP - now I see why everyone is raving about Docker.

@JanChodorowski

This comment has been minimized.

Copy link

@JanChodorowski JanChodorowski commented Mar 28, 2020

If you're having troubles run the docker-compose withouth the -d flag, which puts the process in the background (makes it a deamon). Then you'll be able to see the outputs from the images. For quite some time the wordpress is trying to connect to the DB that is not yet fully set up, so just wait until these appear:

db_1          | 2020-03-28T19:59:56.565903Z 0 [Note] mysqld: ready for connections.
db_1          | Version: '5.7.29'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server (GPL)
@Zayn484

This comment has been minimized.

Copy link

@Zayn484 Zayn484 commented Apr 23, 2020

How can we configure docker to run multiple wordpress sites?

@FrancoisVE

This comment has been minimized.

Copy link

@FrancoisVE FrancoisVE commented May 16, 2020

Sorry to say, a bit sad and disappointed, but this example and setup of using the docker-compose file don't work as advertised/showcased, no matter what I try... even copying and pasting the docker-compose file as is... it just doesn't work, keep getting "Error establishing a database connection". By no means am I a docker or Wordpress SME but I'm definitely no noob. Having to spend hours on something that is advertised/showcased on the Youtube as been easy and quick to get up and running is a real let down, I might as well have just gone the usual route of pulling the base images and building the containers and docker-compose file as I normally would.

If its a case that something has changed in how this Docker + Wordpress + phpMyAdmin setup is supposed to work, surely the necessary updates should be made to the example/tutorial so that the followers/subscribers of the Youtube video/showcase are also up to date and know what's going on... just saying if that's the case for this very annoying error.

I'd also like to point out that if I run the below command in the terminal, i.e. no docker-compose file, that Wordpress spins up which tells me that it could not be the Wordpress image that is the issue, it's the moment the docker-compose file comes into play that all goes sideways

docker run --name some-wordpress -p 8080:80 -d wordpress

I've also tried using different MySql images, thinking that it might be the MySql image that's the cause of this annoying error, i.e. mysql:5.7 as in the example docker-compose file and mysql:latest and still no luck.

Also, I waited quite a considerable amount of time after each bash docker-compose up to give the database service a chance to complete starting up before trying to access the Wordpress site, as I know from past experience with other CMS frameworks like Magento, Drupal, PrestaShop and OpenCart etc. that the database service sometimes can take longer to start up and could cause issues for the front end site, but again still no luck.

image

@zeitgeist2018

This comment has been minimized.

Copy link

@zeitgeist2018 zeitgeist2018 commented May 16, 2020

Sorry to say, a bit sad and disappointed, but this example and setup of using the docker-compose file don't work as advertised/showcased, no matter what I try... even copying and pasting the docker-compose file as is... it just doesn't work, keep getting "Error establishing a database connection". By no means am I a docker or Wordpress SME but I'm definitely no noob. Having to spend hours on something that is advertised/showcased on the Youtube as been easy and quick to get up and running is a real let down, I might as well have just gone the usual route of pulling the base images and building the containers and docker-compose file as I normally would.

If its a case that something has changed in how this Docker + Wordpress + phpMyAdmin setup is supposed to work, surely the necessary updates should be made to the example/tutorial so that the followers/subscribers of the Youtube video/showcase are also up to date and know what's going on... just saying if that's the case for this very annoying error.

I'd also like to point out that if I run the below command in the terminal, i.e. no docker-compose file, that Wordpress spins up which tells me that it could not be the Wordpress image that is the issue, it's the moment the docker-compose file comes into play that all goes sideways

docker run --name some-wordpress -p 8080:80 -d wordpress

I've also tried using different MySql images, thinking that it might be the MySql image that's the cause of this annoying error, i.e. mysql:5.7 as in the example docker-compose file and mysql:latest and still no luck.

Also, I waited quite a considerable amount off time after each docker-compose up to make sure that MySql is fully up and running before trying to open the Wordpress site, as I know from prior experience with Magento etc. that the database service does sometimes take a bit of time to spin up and could cause issues for the website, but still no luck.

Also, I waited quite a considerable amount of time after each bash docker-compose up to give the database service a chance to complete starting up before trying to access the Wordpress site, as I know from past experience with other CMS frameworks like Magento, Drupal, PrestaShop and OpenCart etc. that the database service sometimes can take longer to start up and could cause issues for the front end site, but again still no luck.

image

FrancoisVE I just tested the compose file as it is and works straight away for me, and it pulls all images successfully. Just to confirm, you're accessing port 8000 in your browser, right? Have you checked docker-compose logs?

@zeitgeist2018

This comment has been minimized.

Copy link

@zeitgeist2018 zeitgeist2018 commented May 16, 2020

How can we configure docker to run multiple wordpress sites?

I guess you should run different instances of this compose file, each for one site, so have different databases, etc. But you should change the ports and volume names. If you want to access all these different sites from subdomains of your domain, you could put a fairly simple nginx in front of all of them as a reverse proxy.

@FrancoisVE

This comment has been minimized.

Copy link

@FrancoisVE FrancoisVE commented May 17, 2020

FrancoisVE I just tested the compose file as it is and works straight away for me, and it pulls all images successfully. Just to confirm, you're accessing port 8000 in your browser, right? Have you checked docker-compose logs?

@zeitgeist2018, see docker-compose logs below

db_1         | 2020-05-17 08:06:56+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.20-1debian10 started.
db_1         | 2020-05-17 08:06:56+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
db_1         | 2020-05-17 08:06:56+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.20-1debian10 started.
db_1         | 2020-05-17T08:06:56.504120Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release.
db_1         | 2020-05-17T08:06:56.504219Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.20) starting as process 1
db_1         | 2020-05-17T08:06:56.515796Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
wordpress_1  | WordPress not found in /var/www/html - copying now...
wordpress_1  | WARNING: /var/www/html is not empty! (copying anyhow)
db_1         | 2020-05-17T08:06:56.833900Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
db_1         | 2020-05-17T08:06:57.006957Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: '/var/run/mysqld/mysqlx.sock' bind-address: '::' port: 33060
db_1         | 2020-05-17T08:06:57.102615Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
db_1         | 2020-05-17T08:06:57.108282Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
db_1         | 2020-05-17T08:06:57.141632Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.20'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server - GPL.

and

wordpress_1  | MySQL Connection Error: (2054) The server requested authentication method unknown to the client
wordpress_1  | [17-May-2020 08:07:32 UTC] PHP Warning:  mysqli::__construct(): The server requested authentication method unknown to the client [caching_sha2_password] in Standard input code on line 22
wordpress_1  | [17-May-2020 08:07:32 UTC] PHP Warning:  mysqli::__construct(): (HY000/2054): The server requested authentication method unknown to the client in Standard input code on line 22
wordpress_1  |
wordpress_1  | MySQL Connection Error: (2054) The server requested authentication method unknown to the client
wordpress_1  | [17-May-2020 08:07:35 UTC] PHP Warning:  mysqli::__construct(): The server requested authentication method unknown to the client [caching_sha2_password] in Standard input code on line 22
wordpress_1  | [17-May-2020 08:07:35 UTC] PHP Warning:  mysqli::__construct(): (HY000/2054): The server requested authentication method unknown to the client in Standard input code on line 22
wordpress_1  |
wordpress_1  | MySQL Connection Error: (2054) The server requested authentication method unknown to the client
wordpress_1  | [17-May-2020 08:07:38 UTC] PHP Warning:  mysqli::__construct(): The server requested authentication method unknown to the client [caching_sha2_password] in Standard input code on line 22
wordpress_1  | [17-May-2020 08:07:38 UTC] PHP Warning:  mysqli::__construct(): (HY000/2054): The server requested authentication method unknown to the client in Standard input code on line 22
wordpress_1  |
wordpress_1  | MySQL Connection Error: (2054) The server requested authentication method unknown to the client
wordpress_1  |
wordpress_1  | WARNING: unable to establish a database connection to 'db:3306'
wordpress_1  |   continuing anyways (which might have unexpected results)
wordpress_1  |
wordpress_1  | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 192.168.80.3. Set the 'ServerName' directive globally to suppress this message
wordpress_1  | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 192.168.80.3. Set the 'ServerName' directive globally to suppress this message
wordpress_1  | [Sun May 17 08:07:38.938171 2020] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.38 (Debian) PHP/7.3.18 configured -- resuming normal operations
wordpress_1  | [Sun May 17 08:07:38.938349 2020] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'

and the below log is when I tried using mysql:5.7 as well as mysql:5.7.30

db_1         | 2020-05-17 09:00:47+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.30-1debian10 started.
db_1         | 2020-05-17 09:00:48+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
db_1         | 2020-05-17 09:00:48+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.30-1debian10 started.
db_1         | 2020-05-17T09:00:48.467938Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
db_1         | 2020-05-17T09:00:48.469829Z 0 [Note] mysqld (mysqld 5.7.30) starting as process 1 ...
db_1         | 2020-05-17T09:00:48.473509Z 0 [Note] InnoDB: PUNCH HOLE support available
db_1         | 2020-05-17T09:00:48.473541Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
db_1         | 2020-05-17T09:00:48.473546Z 0 [Note] InnoDB: Uses event mutexes
db_1         | 2020-05-17T09:00:48.473548Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
db_1         | 2020-05-17T09:00:48.473551Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
db_1         | 2020-05-17T09:00:48.473553Z 0 [Note] InnoDB: Using Linux native AIO
db_1         | 2020-05-17T09:00:48.474694Z 0 [Note] InnoDB: Number of pools: 1
db_1         | 2020-05-17T09:00:48.477821Z 0 [Note] InnoDB: Using CPU crc32 instructions
db_1         | 2020-05-17T09:00:48.479110Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
db_1         | 2020-05-17T09:00:48.490303Z 0 [Note] InnoDB: Completed initialization of buffer pool
db_1         | 2020-05-17T09:00:48.492167Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
db_1         | 2020-05-17T09:00:48.513520Z 0 [ERROR] [FATAL] InnoDB: Table flags are 0 in the data dictionary but the flags in file ./ibdata1 are 0x4800!
db_1         | 2020-05-17 09:00:48 0x7f0297aa3740  InnoDB: Assertion failure in thread 139649111177024 in file ut0ut.cc line 918
db_1         | InnoDB: We intentionally generate a memory trap.
db_1         | InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
db_1         | InnoDB: If you get repeated assertion failures or crashes, even
db_1         | InnoDB: immediately after the mysqld startup, there may be
db_1         | InnoDB: corruption in the InnoDB tablespace. Please refer to
db_1         | InnoDB: http://dev.mysql.com/doc/refman/5.7/en/forcing-innodb-recovery.html
db_1         | InnoDB: about forcing recovery.
db_1         | 09:00:48 UTC - mysqld got signal 6 ;
db_1         | This could be because you hit a bug. It is also possible that this binary
db_1         | or one of the libraries it was linked against is corrupt, improperly built,
db_1         | or misconfigured. This error can also be caused by malfunctioning hardware.
db_1         | Attempting to collect some information that could help diagnose the problem.
db_1         | As this is a crash and something is definitely wrong, the information
db_1         | collection process might fail.
db_1         |
db_1         | key_buffer_size=8388608
db_1         | read_buffer_size=131072
db_1         | max_used_connections=0
db_1         | max_threads=151
db_1         | thread_count=0
db_1         | connection_count=0
db_1         | It is possible that mysqld could use up to
db_1         | key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 68196 K  bytes of memory
db_1         | Hope that's ok; if not, decrease some variables in the equation.
db_1         |
db_1         | Thread pointer: 0x0
db_1         | Attempting backtrace. You can use the following information to find out
db_1         | where mysqld died. If you see no messages after this, something went
db_1         | terribly wrong...
db_1         | stack_bottom = 0 thread_stack 0x40000
db_1         | mysqld(my_print_stacktrace+0x2c)[0x55d2960c54ac]
db_1         | mysqld(handle_fatal_signal+0x501)[0x55d2959dced1]
db_1         | /lib/x86_64-linux-gnu/libpthread.so.0(+0x12730)[0x7f0298004730]
db_1         | /lib/x86_64-linux-gnu/libc.so.6(gsignal+0x10b)[0x7f0297adf7bb]
db_1         | /lib/x86_64-linux-gnu/libc.so.6(abort+0x121)[0x7f0297aca535]
db_1         | mysqld(+0x6be079)[0x55d2959a4079]
db_1         | mysqld(+0x6be457)[0x55d2959a4457]
db_1         | mysqld(+0x11ab46c)[0x55d29649146c]
db_1         | mysqld(+0x11aba9e)[0x55d296491a9e]
db_1         | mysqld(_Z6fil_ioRK9IORequestbRK9page_id_tRK11page_size_tmmPvS8_+0x312)[0x55d2964996c2]
db_1         | mysqld(+0x116b75b)[0x55d29645175b]
db_1         | mysqld(_Z13buf_read_pageRK9page_id_tRK11page_size_t+0x37)[0x55d296451fa7]
db_1         | mysqld(_Z16buf_page_get_genRK9page_id_tRK11page_size_tmP11buf_block_tmPKcmP5mtr_tb+0x471)[0x55d296426f91]
db_1         | mysqld(_Z31trx_rseg_get_n_undo_tablespacesPm+0x13e)[0x55d2963c401e]
db_1         | mysqld(+0x10afb97)[0x55d296395b97]
db_1         | mysqld(_Z34innobase_start_or_create_for_mysqlv+0x2f67)[0x55d296399757]
db_1         | mysqld(+0xf842e0)[0x55d29626a2e0]
db_1         | mysqld(_Z24ha_initialize_handlertonP13st_plugin_int+0x55)[0x55d295a2e005]
db_1         | mysqld(+0xbdd3a6)[0x55d295ec33a6]
db_1         | mysqld(_Z40plugin_register_builtin_and_init_core_sePiPPc+0x1dc)[0x55d295ec527c]
db_1         | mysqld(+0x6efe5e)[0x55d2959d5e5e]
db_1         | mysqld(_Z11mysqld_mainiPPc+0x758)[0x55d2959d7308]
db_1         | /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xeb)[0x7f0297acc09b]
db_1         | mysqld(_start+0x2a)[0x55d2959cdc2a]
db_1         | The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
db_1         | information that should help you find out what is causing the crash.

My local setup is:

  • Windows 10
  • Docker Engine 19.03.8
  • docker-compose version 3 used as in example docker-compose file, i.e. used the example docker-compose file as is but took out the phpMyAdmin image to simplify, i.e. only MySql (mysql:latest) and Wordpress (wordpress:latest) images
@hsbgambo

This comment has been minimized.

Copy link

@hsbgambo hsbgambo commented May 30, 2020

Please how can I run this on Google Cloud instance SSH?

@PaamayimNekudotayim

This comment has been minimized.

Copy link

@PaamayimNekudotayim PaamayimNekudotayim commented Jun 12, 2020

Sorry to say, a bit sad and disappointed, but this example and setup of using the docker-compose file don't work as advertised/showcased, no matter what I try... even copying and pasting the docker-compose file as is... it just doesn't work, keep getting "Error establishing a database connection". By no means am I a docker or Wordpress SME but I'm definitely no noob. Having to spend hours on something that is advertised/showcased on the Youtube as been easy and quick to get up and running is a real let down, I might as well have just gone the usual route of pulling the base images and building the containers and docker-compose file as I normally would.

If its a case that something has changed in how this Docker + Wordpress + phpMyAdmin setup is supposed to work, surely the necessary updates should be made to the example/tutorial so that the followers/subscribers of the Youtube video/showcase are also up to date and know what's going on... just saying if that's the case for this very annoying error.

I'd also like to point out that if I run the below command in the terminal, i.e. no docker-compose file, that Wordpress spins up which tells me that it could not be the Wordpress image that is the issue, it's the moment the docker-compose file comes into play that all goes sideways

docker run --name some-wordpress -p 8080:80 -d wordpress

I've also tried using different MySql images, thinking that it might be the MySql image that's the cause of this annoying error, i.e. mysql:5.7 as in the example docker-compose file and mysql:latest and still no luck.

Also, I waited quite a considerable amount of time after each bash docker-compose up to give the database service a chance to complete starting up before trying to access the Wordpress site, as I know from past experience with other CMS frameworks like Magento, Drupal, PrestaShop and OpenCart etc. that the database service sometimes can take longer to start up and could cause issues for the front end site, but again still no luck.

image

@FrancoisVE in wp-config.php change the define( 'DB_NAME', '**wordpress**'); to the value of MYSQL_DATABASE from docker-compose.yml e.g:
MYSQL_DATABASE: dev_docker_wordpress so you need to change define( 'DB_NAME', 'wordpress'); to define( 'DB_NAME', 'dev_docker_wordpress') it should help

@hakeemajibolu1

This comment has been minimized.

Copy link

@hakeemajibolu1 hakeemajibolu1 commented Jun 15, 2020

Thanks a lot Brad.
This is way better than using local servers, it was insanely interesting especially after going through many challenges of Windows 10 vs local servers 😊

@FrancoisVE

This comment has been minimized.

Copy link

@FrancoisVE FrancoisVE commented Jun 15, 2020

Sorry to say, a bit sad and disappointed, but this example and setup of using the docker-compose file don't work as advertised/showcased, no matter what I try... even copying and pasting the docker-compose file as is... it just doesn't work, keep getting "Error establishing a database connection". By no means am I a docker or Wordpress SME but I'm definitely no noob. Having to spend hours on something that is advertised/showcased on the Youtube as been easy and quick to get up and running is a real let down, I might as well have just gone the usual route of pulling the base images and building the containers and docker-compose file as I normally would.
If its a case that something has changed in how this Docker + Wordpress + phpMyAdmin setup is supposed to work, surely the necessary updates should be made to the example/tutorial so that the followers/subscribers of the Youtube video/showcase are also up to date and know what's going on... just saying if that's the case for this very annoying error.
I'd also like to point out that if I run the below command in the terminal, i.e. no docker-compose file, that Wordpress spins up which tells me that it could not be the Wordpress image that is the issue, it's the moment the docker-compose file comes into play that all goes sideways

docker run --name some-wordpress -p 8080:80 -d wordpress

I've also tried using different MySql images, thinking that it might be the MySql image that's the cause of this annoying error, i.e. mysql:5.7 as in the example docker-compose file and mysql:latest and still no luck.
Also, I waited quite a considerable amount of time after each bash docker-compose up to give the database service a chance to complete starting up before trying to access the Wordpress site, as I know from past experience with other CMS frameworks like Magento, Drupal, PrestaShop and OpenCart etc. that the database service sometimes can take longer to start up and could cause issues for the front end site, but again still no luck.
image

@FrancoisVE in wp-config.php change the define( 'DB_NAME', '**wordpress**'); to the value of MYSQL_DATABASE from docker-compose.yml e.g:
MYSQL_DATABASE: dev_docker_wordpress so you need to change define( 'DB_NAME', 'wordpress'); to define( 'DB_NAME', 'dev_docker_wordpress') it should help

Thank you this works better

@ibenzyk

This comment has been minimized.

Copy link

@ibenzyk ibenzyk commented Jul 9, 2020

Hey guys, I need your help with running it on digitalocean. ones i copied over file and run docker-compose up -d i can access wordpress using my digitalocen ip and port 8000. I was trying to set up nginx as reverse proxy for access it by domain name directly but no luck. Could any one help me?

@jakubpartyka

This comment has been minimized.

Copy link

@jakubpartyka jakubpartyka commented Jul 17, 2020

Extremely helpful, thanks a lot

@happy4u2

This comment has been minimized.

Copy link

@happy4u2 happy4u2 commented Sep 10, 2020

Fantastic work.. very , very useful and time saving stuff. excellent comments also

@enkr1

This comment has been minimized.

Copy link

@enkr1 enkr1 commented Sep 20, 2020

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.