Circle CI 2.11 Enterprise: Docker services inaccessible

Hi Support,

We’re an enterprise customer that has stepped thru the upgrade procedure and have recently been met with pre 2.0 builds failing, specifically during test scenarios that require instances of certain datastores (mongo, postgres, solr etc.) to be tested against localhost. But are currently seeing the following:

  1. previous containers are not cleaned up:

make solr
docker run
-d
-p 8981:8983
solr:7.1-alpine
bd723464aab62f41c8636bd6700d2e7f11c80a127828fc379b7102dfdf92146f
docker: Error response from daemon: driver failed programming external connectivity on endpoint laughing_panini (5bf2224f1fb54c6598c97407e877961aa35c32d1556c4ab35b9d096f23ff948c): Bind for 0.0.0.0:8981 failed: port is already allocated.
make: *** [solr] Error 125

make solr returned exit code 2

ENV=test make elasticsearch
docker run -p 9201:9200
-d
-e “http.host=0.0.0.0”
-e “transport.host=127.0.0.1”
-e “xpack.security.enabled=false”
docker.elastic.co/elasticsearch/elasticsearch:5.2.2
aba16e3867daa954483e81d1297fd40b33acd59e8fcce308c4ea6c683aae470e
docker: Error response from daemon: driver failed programming external connectivity on endpoint lucid_goodall (99e8498856ba343246c1d7b8d1082fdd0d4edd7e4b359f5f4f548f4a178d3f64): Error starting userland proxy: listen tcp 0.0.0.0:9201: bind: address already in use.
make: *** [elasticsearch] Error 125

ENV=test make elasticsearch returned exit code 2

  1. issues with test references to localhost are now failing whereas it worked in 1.4.6.x

Failure/Error: Repositories::DressRepository.new.create_index!(force: true)

Faraday::ConnectionFailed:
Failed to open TCP connection to localhost:9201 (Connection refused - connect(2) for “localhost” port 9201)

We suspect this is due to the nature of changes between 1.x and 2.x specifically running docker containers in lxc vs docker-in-docker, and have not been able to solve these issues without asking users of CCI enterprise to migrate to 2.0 or rework their existing builds to reference well known hostnames/docker instance names etc. What is circle-ci’s recommendation here?