Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

290
Views
Unblocking port 80 / nginx / docker

I want to get a Laravel application running in Docker, but am failing at the first hurdle, I have tried to use the docker/getting started Docker image with the following command but am getting the below blockage.

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

docker: Error response from daemon: Ports are not available: listen tcp 0.0.0.0:80: bind: address already in use.

Listing out what is running is here:

$sudo lsof -i :80

COMMAND   PID          USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
nginx     143          root    6u  IPv4 0x17106caf335097c7      0t0  TCP localhost:http (LISTEN)
nginx   10145 Jeremyrrsmith    6u  IPv4 0x17106caf335097c7      0t0  TCP localhost:http (LISTEN)
nginx   10218 Jeremyrrsmith    6u  IPv4 0x17106caf335097c7      0t0  TCP localhost:http (LISTEN)
nginx   10296 Jeremyrrsmith    6u  IPv4 0x17106caf335097c7      0t0  TCP localhost:http (LISTEN)
nginx   10372 Jeremyrrsmith    6u  IPv4 0x17106caf335097c7      0t0  TCP localhost:http (LISTEN)

From what I read I needed to kill whatever was running on port 80, so have killed them (exception of 143 which errors), but they restart with a new PID. Should I actually be killing these?

The Docker: Error response from daemon: Ports are not available: listen tcp 0.0.0.0:80: bind: address already in use. error is causing me a headache.

netstat -ltnp | grep 80 is a common command to run according to other threads, but i get netstat: option requires an argument -- p as a response. Having read into that, is that the first is a Linux command (was not clear to me in other threads). I'm on a Mac. lsof -n -i4TCP:80 | grep LISTEN is the command on mac (hope it helps others). That provides

nginx   10145 Jeremyrrsmith    6u  IPv4 0x17106caf335097c7      0t0  TCP 127.0.0.1:http (LISTEN)
nginx   10218 Jeremyrrsmith    6u  IPv4 0x17106caf335097c7      0t0  TCP 127.0.0.1:http (LISTEN)
nginx   10296 Jeremyrrsmith    6u  IPv4 0x17106caf335097c7      0t0  TCP 127.0.0.1:http (LISTEN)
nginx   10372 Jeremyrrsmith    6u  IPv4 0x17106caf335097c7      0t0  TCP 127.0.0.1:http (LISTEN)

I kill these PID and they just restart with a new PID, I don't think that I need them, but are they system related? How do I kill them for good and are they actually blocking me from using port 80 for Docker?

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

The easiest and most common way around used ports is using a different port-mapping e.g. docker run -p 8080:80 docker/getting-started and accessing via localhost:8080

If you want to use port 80 you probably have to stop the nginx service rather than killing the process.

over 4 years ago · Santiago Trujillo Report

0

I think it's laravel valet. I have just $valet stop which i think has solved it. As lsof -n -i4TCP:80 | grep LISTEN now returns nothing and running the docker command has set up a container. So port 80 was blocked by nginx, which was added by laravel valet, and to use port 80 you need to stop valet, and restart it when you dont need the port anymore. I think.

over 4 years ago · Santiago Trujillo Report

0

You have nginx running on your device which is blocking port 80, just as you said yourself.

Have you installed nginx yourself? Is it installed as a system service, that is started automatically when you power up your device?

If it runs as a system service, you probably will need to gradually shut it down using the appropriate system command, instead of trying to kill the processes. I don't know what the command for this is on Mac, but you will find out if you search for it.

On linux, depending on your system, this could e.g. be systemctl stop nginx.

Do you know where the nginx process comes from?

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!