failed: port is already allocated

Do Nhu Vy picture Do Nhu Vy · Jan 7, 2017 · Viewed 20.4k times · Source

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?

Answer

user2915097 picture user2915097 · Jan 7, 2017

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