Docker Community Forums

Share and learn in the Docker community.

Port si already allocated


(Fresnizky) #1

Expected behavior

docker start container_name

Container starts

Actual behavior

docker start container_name
Error response from daemon: driver failed programming external connectivity on endpoint container_name(4322007ea879acae866ebafdbdccf382a9bdfce31298d013da80a549e321d723): Bind for 0.0.0.0:3306 failed: port is already allocated
Error: failed to start containers: container_name

Information

I have no running containers
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

Tried restarting docker from the GUI and it still failed. I had to exit docker and start again to make it work again.


(Ganessh Kumar) #2

docker ps lists only the running containers. Use docker ps -a to see the list of all the container, it will list the containers that are stopped as well.

May be a stopped container is using the port . Use

docker rm <container_name>
or 
docker rm <container_id>

to remove the container. Port will be released only when the container is removed.

If no containers are using the port, use netstat to see if any other process is using the port. Equivalent linux command netstat -an | grep (port)