I am trying to run one docker image and it is saying address already in use
driver failed programming external connectivity on endpoint jovial_saha (c79c98cbcef6340cd7867571278f401c9cbea1fd7137a39fe5d7de1c454d4e6e): Error starting userland proxy: listen tcp 0.0.0.0:9042: bind: address already in use.
However i have deleted all containers and images and then even if i call to run my image by
docker run -d -p 9042:9042 myimage . i get above error. what should i do ?
You can give the container a known name with the docker run --name option, and use that name in the docker stop and docker rm commands (and elsewhere) without having to look up the container ID. You could use the following command to kill the running container that occupies a given port:
docker kill immediately stops/kills the running containers (by sending the SIGKILL signal to the main process inside the container). You can also choose to gracefully stop all running containers by using the docker stop command instead of docker kill. Hope you found this post useful. It was published about 4 hours ago.
Port mapping makes the processes inside the container available from the outside. While running a new Docker container, we can assign the port mapping in the docker run command using the -p option: The above command launches an httpd container and maps the host’s port 81 to port 80 inside that container.
For docker stop command we have to pass container id in an automation script that i am not able to do You can give the container a known name with the docker run --name option, and use that name in the docker stop and docker rm commands (and elsewhere) without having to look up the container ID.
To expand on Robert Moskal's answer, you'll need to kill whatever's already on that port:
fuser -k 9042/tcp
Happy hunting!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With