Question

MySQL and Wordpress Dockers do not keep running

  • Posted November 15, 2014

Dear all, I want to get Wordpress running using Docker on CoreOS. I followed all the instructions for MySQL, I gave the following command:

docker run --name wordpress-mysql -e MYSQL_ROOT_PASSWORD=rtpassword -e MYSQL_USER=fvhemert -e MYSQL_PASSWORD=usrpassword -e MYSQL_DATABASE=wordpress -d mysql

Stangely, the container run for a short while, typing “docker ps” I see it but after some second I “docker ps” again and it is gone, I still see it using “docker ps -a”.

Subsequently I give the command:

docker run --name fvhemert-wordpress --link=wordpress-mysql:mysql -e WORDPRESS_DB_USER=fvhemert -e WORDPRESS_DB_PASSWORD=usrpassword -e WORDPRESS_DB_NAME=wordpress -p 8080:80 -d wordpress

There a no further errors but “docker ps” does not show any running containers, they both are present when typing “docker ps -a” and have that status “excited”. Why?

I don’t want them exited, I though that the “-d” argument would make them runs as daemons and keep them active? There is not active page on the ip.adres:8080 or ip.adres:80.

Any suggestions? What am I doing wrong?

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

@fvhemert

Your original mysql docker command is as follows:

docker run --name wordpress-mysql -e MYSQL_ROOT_PASSWORD=rtpassword -e MYSQL_USER=fvhemert -e MYSQL_PASSWORD=usrpassword -e MYSQL_DATABASE=wordpress -d mysql

“Looking” at this i think you are missing the -p command that specifies a port for mysql operations aka tcp:3306.

There are two ways you can sort this out.

  1. use --expose 3306 when running mysql container.

  2. use -p :3306:3306 when running mysql container. (just make sure you don’t allow wan access on 3306).

Hopefully, this should solve your problem.

Best Regards Hareem Haque

First, check your logs by typing docker logs my-container-name and see what’s going on.

I had a similar problem (MySQL on Ubuntu14.04+Docker), and it turned out it was because I was trying to get MySQL up and running on an instance with only 512MB RAM. Since DO’s images don’t come with a swap file enabled by default, MySQL was filling up the RAM and then – having nowhere to page memory when it fills up – failing.

The two easiest ways to fix this are:

  1. Spin up an instance with at least 1GB of RAM.
  2. Add a swap file to your instance.

Hope this helps.

First, check your logs by typing docker logs my-container-name and see what’s going on.

I had a similar problem (MySQL on Ubuntu14.04+Docker), and it turned out it was because I was trying to get MySQL up and running on an instance with only 512MB RAM. Since DO’s images don’t come with a swap file enabled by default, MySQL was filling up the RAM and then – having nowhere to page memory when it fills up – failing.

The two easiest ways to fix this are:

  1. Spin up an instance with at least 1GB of RAM.
  2. Add a swap file to your instance.

Hope this helps.

If you have $5 512M Droplet, just enable swap. https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-12-04 I stuck with this for a few days until I found this solution.

I’m having the same problems. How did you guys solve this?