Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

failed: port is already allocated

I use Docker for running Oracle 11g Express on macOS Sierra 10.12.2

https://github.com/wnameless/docker-oracle-xe-11g

This is my error:

Last login: Sat Jan  7 22:42:11 on ttys000
➜  ~ docker run -d -p 49160:22 -p 49161:1521 wnameless/oracle-xe-11g
docker: Cannot connect to the Docker daemon. Is the docker daemon running on this host?.
See 'docker run --help'.
➜  ~ docker run -d -p 49160:22 -p 49161:1521 wnameless/oracle-xe-11g
043d8caecbb45d6e2e5999b69a2f760c20d53ff3aa2fad78cb1eb70acb058a1f
docker: Error response from daemon: driver failed programming external connectivity on endpoint serene_lalande (08bb0bd9684c0f92db7b736986bf894d3a57a714324405823496d13e175e7491): Error starting userland proxy: Bind for 0.0.0.0:49161 failed: port is already allocated.
➜  ~ 

I diagnostic:

➜  ~ netstat -anp tcp | grep 49161                                  
tcp4       0      0  192.168.1.2.49161      17.188.166.13.5223     ESTABLISHED
➜  ~

➜  ~ docker --version
Docker version 1.12.5, build 7392c3b

My Dianostic ID: 20EB9506-CC72-4093-8A15-60E05A841ED1

I don't know why. Before that few weeks, it run success. Nearly, I change, release new DHCP IP. How to run Docker instance has Oracle 11g express success?

like image 916
Do Nhu Vy Avatar asked Jan 07 '17 15:01

Do Nhu Vy


People also ask

How do I remove all images from docker?

Remove all Containers: To remove all containers from the docker-machine, we need to get the ids of all the containers. We can simply get the ids of the containers with the command docker ps -aq, then by using the docker rm command, we can remove all the containers in the docker-machine.

Can multiple containers use the same port?

So there is no conflict if multiple containers are using the same port ( :80 in this case). You can access one container from another using its container-name or service-name or ip-address, whereas ip-address is not a good idea because this might change every time you (re)start the container.


1 Answers

you can't launch twice

docker run -d -p 49160:22

as this means you want to allocate the port 49160 on the host twice, of course, the second time, you get you error message, try for the second run

docker run -d -p 49161:22

like image 73
user2915097 Avatar answered Oct 18 '22 07:10

user2915097