Hello all I am new to Docker and docker networking so I had a question about containers, images and how one accesses these docker images locally. I am trying to install and configure Leantime on a server running Ubuntu LTS 22.04.3 and I just seem to be chasing my tail. I’ve watched some videos on docker networking and the install and set up of LeanTime however I can’t seem to figure out the web-app access. I am only using this on my LAN so I do not need to publish ports. The networking instincts in me is saying that I need to get the image on the same local network which is your standard 192.168.1.0 where as LeanTime-net is created and uses a 172 ip config am I on the right track with the networking? I’m just kind of stumbling around in the dark over here and would welcome any suggestions you might have. Excuse any terminology issues as well as I am still learning the lingo.
Hi,
Yes, by default, containers are created in their own network range, but I dont think you understand the publish port thing, when docker is publishing ports, its not to the internet, its to the rest of the network, so for your 192.168.1.0 to access your container in ip 172.x.x.x, it needs to “publish” the port.
So lets say that your container has a service that listens on port 80 (example, i dont know anything about leantime) then you need to start your container with "docker run … -p 8080:80 … " meaning that you can access the service, from your 192.168.1.0, on port 8080 (http://HOST:8080), but the container will map that port 8080 to 80 inside the container. docker run | Docker Documentation
Thank you very much terpz that helped me out a lot I’m up and running all is well!