Port to hostname

Hello, I discovered Docker recently and I managed to install the BookStack app (alternative to wikipedia) in a container and it’s all good. I access the app without any problem and everything works.

What should I do to be able to access from my browser as example. mypagedocker/ instead of

Thank you for your help

You cannot map a single port to a specific hostname (and then another port to another hostname). Instead, one or more hostnames can be mapped to an IP address, regardless the port that is used. (This is not a limitation of Docker, but just how networking works.)

  • To map somename or, say, somename.com to an IP address you’ll need DNS. Or, just for your local machine, a hosts file may suffice.

  • To make your browser not require a port number to be specified, you’ll need to use the default port. For HTTP that is port 80. (For HTTPS it’s 443, but that may be too hard to configure since you’re asking this.) So, to use http://somename without a port number, you will need to expose your app on port 80 rather than 6875. You probably have some -p or --publish parameter in the command you use to run your container?

1 Like