0

I have a docker compose file that sets up an apache server. The purpose of this is for development on my local network.

All is working great and I can access it on the PC I am running docker on. If I type localhost:80 I get the sample PHP index file.

I am now wanting to be able to access this from other machines on my local network. I have been reading the docs and it looks like bridge networking is what I should be looking at.

Am I correct in this assumption?

I am also wanting to add self signed certificates to the Apache server so I can use https over the local network so want to make sure Bridge networking will allow for that as well.

Can anyone offer some advice?

fightstarr20
  • 11,682
  • 40
  • 154
  • 278
  • 1
    you need to get the ip of your computer on your network and you'll be able to access your application from that IP. - for https - I haven't attempted this – Denis Tsoi Jan 21 '19 at 13:03

1 Answers1

1

User-defined bridge network is all you need for that if you are not planning to split your containers onto several host machines. You don't have to configure it explicitly as soon as docker-compose create default network for you. All you need is to define tcp/udp ports which should be available outside network and expose them.

Thus you get all your exposed services visible with your host's machine ip address/host name.

By default Docker binds exposed ports to all available interfaces, but if you need your services to be available only on particular ones, use following syntax:

ports:
  - "<interface_ip>:<host_port>:<container_port>"
grapes
  • 8,185
  • 1
  • 19
  • 31