I want to expose my docker container to other machines connected to the same network (if matters, wifi network).
Locally (call it PC1 for example), I expose my apache2 server as 8080:80 using docker - so now when running http://localhost:8080 on PC1, I can view my website because 8080 is assigned to port 80 via apache2 container on the local docker bridge network.
What are the steps to expose 8080 from PC1 to another machine (PC2) on that same home network?
By using the
-p 8080:80
flag on yourdocker run
command, you've actually already exposed it to your local network. Docker manipulates iptables to expose the port(s) you specify on all the network interfaces present on your machine.From a different computer on your LAN, you should be able to just access http://LAN_IP:8080 where LAN_IP is PC1's LAN IP address (e.g. 192.168.0.X).