Dear all,
I’m running test with my docker container under circleci, one of my services in docker container will use 9010
port. When I mount the docker container with
docker run -d --name mycontainer -p 9010:9010 my/dockerimage
and then go inside container before launch my service, with cmd
netstat -ap | grep :9010
it shows
root@940963d# netstat -ap | grep :9010
tcp6 0 0 [::]:9010 [::]:* LISTEN -
the port is occupied, thus my service cannot run. Tested with other port with my service, it runs ok. Any inside for such issue ? Thank you in advance.
when I run same docker image locally, there is such issue.
Hi,
Can you show us any related error logs? I tried this on a base Ubuntu container with port 9010 and 9595 (just for completeness) and no problems with either. Within the CI environment (the LXC container), netstat showed the port binded by Docker, which is expected. Within the Docker container, netstat showed nothing as I would running bare container.
Dear Fellclano
Under my SSH debug environment, I run
docker run -d --name tmp4 -p 9012:9012 ubuntu:14.04.4 tail -f /dev/null
and get inside container
sudo lxc-attach -n "$(docker inspect --format '{{.Id}}' tmp4)" -- /bin/bash
run:
netstat -ap | grep :9012
it shows
root@8ac854be9af5:/# netstat -ap | grep :9012
tcp6 0 0 [::]:9012 [::]:* LISTEN -
testing on another non-mapping port, ex: 9015, it shows nothing, that is ok.
And, yes as you said, when I use general
ubuntu (without tag)
docker run -d --name tmp4 -p 9012:9012 ubuntu tail -f /dev/null
everything is ok, so the problem is just conflict with
ubuntu:14.04
ubuntu:14.04.4
ubuntu:15.10
since my docker image is based on that. And the current ubuntu:latest
is based on ubuntu:16.04