I’m currently getting started with Docker on a Linux VM provided by my university. To get started with docker I’m doing their tutorial (https://docs.docker.com/get-started/part2/#run-the-app). After creating the files the tutorial says to use the command: docker run -p 4000:80 <name of container>
This should host the container on http://localhost:4000 because port 80 is mapped to 4000. But unfortunately when I go to localhost this is shown:
This site is not available. Localhost has refused the connection.
Thanks for the help!
Advertisement
Answer
If you are running docker on a remote VM and want to connect from your machine browser, you need to replace localhost
either with the VM hostname or IP. So connect to http://hostname:8080