Nick
Nick

Reputation: 771

Docker nginx ports are not available

I am trying to use nginx on docker for windows using

docker container run --publish 80:80 nginx

it is getting the error like below:

C:\Program Files\Docker\Docker\resources\bin\docker.exe: Error response from daemon: Ports are not available: listen tcp 0.0.0.0:80: bind: An attempt was made to access a socket in a way forbidden by its access permissions.

can anyone give me the solution......

Upvotes: 2

Views: 4302

Answers (1)

Adiii
Adiii

Reputation: 59896

As you can see the error is clear Ports are not available: listen tcp 0.0.0.0:80: because the port is occupied. you have two option

  • Kill the process the occupied the port and then run the container
  • Publish different port then 80 for the Nginx contianer
 container run --publish 81:80 nginx then localhost:81

Now open http://localhost:81 should work.

Upvotes: 3

Related Questions