User: Hey guys, I’ve got a few applications installed. I want to create custom ports on the host to make it easier to remember on which port what application is.
How to do it with Docker?
First you need to check which exposed port your application has:
If you ever run it before just type in docker ps -a In the Ports column, you’ll find an IP. What you should be interested in, is the content after the pointer (->). For example, 0.0.0.0->5000.
docker ps -a
Still, if you haven’t run it before, the port needs to be checked first. Type docker inspect app name (eg. docker inspect buddy). It’ll open the logs - what needs to be extracted is "ExposedPorts"
The next step is to run the application with docker run -p (provide the port you want to have there along with the one taken from the exposedport, eg. docker run -p 9090:5000 my-app
That’s it! After entering localhost:9090 your application will be run