Reputation: 96454
For instance if docker is my runtime environment on my local machine and the application (or other tools) I want to use runs in a browser within the container.
Put another way, what do I need to do in order for my "local locahost" to be the "docker localhost" when viewed in a browser in my local (non-docker) environment?
Upvotes: 0
Views: 2079
Reputation: 2243
Consider docker container as a process that is running on your system. Now your use case is to access the application that is running inside docker container thought your host browser.
In that case you need to port forward the host port to the port on which your application is running inside the container.
Command:
docker run -p [any available host port]:[container app port] imagename:tag [startup command if any]
After running this command, you can access your application through your host browser.
Upvotes: 2
Reputation: 891
Your apps and tools do not run in another browser. Rather you map ports on your system to the container to access the container tools and applications from your system browser. For example if I had an image that was serving traffic on port 80 I may do something like:
docker run -d -p 9801:80 mywebserver:latest
The -d will run it in detached mode so that I do not need to keep the window open. the -p is where I am mapping port 9801 on my local system to port 80 on the container.
Next I can simply navigate to localhost:9801 in my browser and whatever tool is running on port 80 in the container will be accessible.
Upvotes: 2