Accessing Docker Container Ports


#1

Hello Community,

I am in the process of migrating our old build that relies heavily on Docker (Compose) to Circle CI 2.0 Beta. I can successfully start the docker engine and the output is for instance:

Allocating a remote Docker Engine
...
Remote Docker engine created. Using VM 'prealloc-...'
Created container accessible with:
  DOCKER_TLS_VERIFY=1
  DOCKER_HOST=tcp://aaa.bbb.ccc.ddd:2376
  DOCKER_CERT_PATH=/tmp/docker-certs...
  DOCKER_MACHINE_NAME=...

The installed docker-compose client can also pull our private images and run them as reported in the log:

           Name                         Command               State                                             Ports                                            
----------------------------------------------------------------------------------------------------------------------------------------------------------------
my-api                       npm start                        Up      0.0.0.0:8091->80/tcp, 8091/tcp                                                             
...
rabbit                       docker-entrypoint.sh rabbi ...   Up      15671/tcp, 0.0.0.0:15672->15672/tcp, 25672/tcp, 4369/tcp, 5671/tcp, 0.0.0.0:5672->5672/tcp 

All relevant ports have been mapped and could successfully be used from outside the docker machine in old 1.0 builds and outside of Circle CI. Now, when I try to connect to our service on port 8091 it times out regardless of the suspected IP addresses I use … the reported aaa.bbb.ccc.ddd, the usual 192.168.99.100, even the container addresses 172.18.0.xxx etc. Which IP addresses do I need to use to get to my exposed services in that docker-machine?

Much obliged and cheers,

K


#2

You can not connect to your containers via TCP when you are using the base docker executor.


Why might my web requests to a Docker-in-Docker container be refused?
#3

@rohara: is there a way to connect to the containers in any way, then?

i reckon it is related to https://circleci.com/docs/2.0/executor-types/ .

is it something I can change somewhere?

… or are you hinting that I need to run everything in containers … the same docker?


#4

Either use the machine executor or docker exec from the docker executor.


#5

@rohara … OK, gotcha, thx!


#6