How to share a common IP between Docker containers

Sometimes you may build your images manually and don’t need something special but something to be used asap.

Such case happened when I wanted to tell php where is the mysql server. Usually after creating and removing containers you may see the mysql container’s ip changed and you have to change the configuration in your site again.

I’ve decided to use one approach that helps me set and forget about the sites’s configuration files and this is using a common IP inside my Docker host that is not or

I’ve made one ifconfig and I’ve seen these lines:

docker0 inet addr:

lxcbr0 inet addr:

I just used docker run …… -p …/mysql

Then in the sites’s configs the mysql host was given as instead of or 172.17.0.X

That was since Docker version 0.9.0 went out. I now see only the docker0 ip which still solves the problem the same way with different common IP. I am using libcontainer’s API, no -e lxc, only custom docker data and temp directories set in the defaults file.

How to increase the timeouts when using Nginx, PHP-FPM and phpMyAdmin

Today I needed to change some tables’ structures using phpMyAdmin.

To my surprise not long after I clicked Go to execute the queries, many errors started comming from nginx and php.

So I started looking around about any timeout settings I can use in nginx and php5-fpm and the final working result is this (I choose a timeout of 600 seconds):


max_execution_time = 600


request_terminate_timeout = 600

in nginx conf of my site inside the *.php location settings:

fastcgi_read_timeout 600;

reload/restart your php and nginx servers for the new changes to take effect and you are ready. Test it by executing some queries that you know will take more time than usual.

Here’s a good source and more settings and information.

If you’re going to change the nginx and php settings of the servers running inside Docker containers you better use this syntax:

servername reload

instead of:

servername restart

Or your container may be automatically stopped after the restart is executes as the restart command is just short for: stop->start.


if you’re using phpMyadmin behind Cloudflare, check their thoughts about that: