Docker Community Forums

Share and learn in the Docker community.

Yes, another annoying question about bridge and webservices

(Redsandev) #1

Hi All, are you fine? Because in the next few words I will repeat a “famous” question:

Why apache/laravel server configuration needs a for localhost when I run their container in a docker-machine?

Any times I get up a docker-machine, any container I will set it needs a specific IP configuration in apache/laravel config-file.

So, let me show you a little shell-stuff

1) Jump in!
I have a docker-machine driver=virtualbox, with a specific IP address ( and inside i put a container with
docker run -ti --name=FunnyBunny debian
2) Install common-stuff
I just followed Laravel-wiki to install laravel or, for apache machine I choose a digitalocean tutorial: please this is not any kind of adv-strategy: Google shows these!
3) let’s start!
For laravel I need to use (ok, port is not the real problem)

php artisan serve --localhost= --port=8080

And as the same way for apache, I need to configure file


modify ServerName to


And, in the end, modify ports.conf in


and modify Listen in that way


So, I’m sure to give more details that you need, but the point still here: Why I need to add ip for these kinds of services, when put the same container out docker-machine (just run docker without eval-command) I don’t need to do them?

Thank you so much!

(Sam) #2

apache needs to configure a tcp/ip listen for incoming traffic.

the listen takes 2 parms
ip address (in case u have multiple) and port

if you don’t CARE what ip address to use (you only have one, or the default is ok), then u code
note that is different than (which will ONLY be listening INSIDE this box. )