docker: Error response from daemon: driver failed programming external connectivity on endpoint …: Bind for failed: port is already allocated.

So, I’m trying to run Jenkins via Docker with:

docker run -d -v jenkins_home:/var/jenkins_home -p 8080:8080 -p 50000:50000 jenkins/jenkins:lts

but getting:

Clearly the previous time I ran Jenkins the container hadn’t been cleanly stopped. Or there was another container using that port (it turned out to be the latter).

Here’s how to fix it.

  1. check port: netstat -nl -p tcp | grep 8080 (interestingly this didn’t show anything even though:
  2. docker ps(showed a container using this port)

docker stop <container name>

to solve the problem.

Leave a Reply

Your email address will not be published. Required fields are marked *