Elroy Toscano
Elroy Toscano

Reputation: 541

Reset localhost:80 port

running containersall containers I've recently started learning docker and after following the tutorial, I ran the following command

docker run -d -p 80:80 docker/getting-started

and open up port localhost:80 and saw the docker getting started page. However, I had to run my client's project, whose port was mapped to localhost:80 as well. On account of this, I'm unable to run my client's project on localhost:80. In addition to that, any instance I randomly open up docker and then switch to localhost:80, it redirects to docker's getting started tutorial. I want to reset this localhost:80 port so that when I run my client's project, I can map them to localhost:80. Any method to rectify the issue?

Upvotes: 0

Views: 1820

Answers (4)

jmorell
jmorell

Reputation: 13

First search for the container to see if its open:

docker container ls

If it's not then the page is probably cached by the browser. I found this to be especially true when using Chrome.

So, if you don't see your container then use your browsers clear cache tool.

In Chrome this is as easy as right clicking on the page and selecting inspect, then right clicking the refresh page icon and selecting hard refresh.

Upvotes: 1

Arya Sukma Wijaya
Arya Sukma Wijaya

Reputation: 1

All you have to do is stop the container you just started (docker / getting-started). You can open a command prompt, then type this command:

docker container ls

You can see which containers are currently running. For example:

docker containers list

You just need to do this command for the stop container:

docker container stop *yourContainerName*

Upvotes: 0

Dominic Holt
Dominic Holt

Reputation: 162

You can use docker to map the container port to any port you choose on your local machine. As an example, you could use your docker getting started and map the port to 8080 instead of 80 like this:

docker run -d -p 127.0.0.1:8080:80/tcp docker/getting-started

Upvotes: 0

programandoconro
programandoconro

Reputation: 2709

First find you container's ID using:

docker ps

Supposing it is e11d9f8bb730, you can now stop and remove the container with:

docker stop e11d9f8bb730
docker rm e11d9f8bb730

Run again your container, this time using a different port:

docker run -d -p 81:80 docker/getting-started

Now your container is running on port 81 and you will be able to run your client's App on port 80.

Upvotes: 1

Related Questions