Error when using docker bridge driver


I’m working on pymssql where we are using docker-compose to spin up mssql and a python manylinux image to build and run tests. Some of the test use tcp to verify that different connection styles. To run the test locally I use the bridge driver in the docker-compose.yml and set the IP of the machines so that the test can run. The docker-compose.yml looks like:

version: '2'

   image: microsoft/mssql-server-linux
    - 1433:1433
     driver: "none"

      - sqlserver
      - .:/io

    driver: bridge
       - subnet:

I am now trying to use this with the local circleci cli tool and get the following error:

  #!/bin/sh -eo pipefail
docker-compose up -d

Creating network "project_vpcbr" with driver "bridge"
ERROR: Pool overlaps with other one on this address space
Error: Exited with code 1
Step failed
Error: runner failed
Task failed

My config.yml file looks like:

version: 2
            - image: docker/compose:1.22.0

            - checkout
            - setup_remote_docker

            - run:
                name: folder listing for debugging
                command: ls -al

            - run:
                name: Build docker-compose containers
                command: |
                  docker-compose build

            - run:
                name: Start containers
                command: |
                  docker-compose up -d

            - run:
                name: Show dists
                command: |
                  ls dists/

Any suggestions on how I can use a static ip address with the containers so that our tcp connection tests can run in circleci?

Is the thing that makes a connection a service within Docker Compose, or do you want all services to be reachable from outside DC?

Yes the connection is made from the pymssql container to the sqlserver container. None of the services need to be reachable from outside of the container running docker compose and the two containers that are part of the compose setup.

Great. Just use the names then - Docker Compose adds network names to avoid having to hardwire IPs. As long as they are on the same virtual network, sqlserver will be reachable from pymssql, and vice-versa. My guess is that you can delete the networks section entirely, and remove the network entries from each service.

We use that (network names) to validate we can connect via hostname, but the CI/CD is for a Python package that others use to connect to SQL Server. Because of that one of the things we test in our code is that connection strings based on IP succeed not just hostname. Due to that we need to be able to have an IP for the sql server container to validate that tests for IP based connection strings succeed.

OK, so in your test, do a DNS lookup of sqlserver and convert it to an IP on-the-fly. Would that be a good enough test?

If there isn’t a static IP solution I can take that back to the team. This project has used IP based testing for years so I’m not sure the full scope of the IP based testing, but I can see and validate they are skipped when we can’t provide an IP address to the db conf file. It may be writing the DNS lookup in the container and having it write a new line into the conf file, but would only want to explore that if a static address isn’t an option.

You could also try other private LAN ranges. I am not sure why you get the error you do, since you are running your own Docker system.

You could also checkout various other reports of this error - I see the Moby project is one of those results.

Got it. I’ll give that a try. Since this worked locally with docker-compose but failed with the circleci local tool I wanted to open the issue and make sure this wasn’t something that just wasn’t supported with CircleCI. I’ll try the private ranges and look into some of the reports as you mentioned.

1 Like

So I was able to resolve the network issue. I had to run docker-compose down, so that was an error on my end. Sorry about that, leaving this here in case anybody else does similar in the future. Once you mentioned this should work I started digging around for what could cause the issue on my end. The next thing I ran into was volumes which has plenty of post. I switched my executor to machine, but now I get this error:

  #!/bin/bash -eo pipefail
mkdir -p /home/circleci/project && cp -r /tmp/_circleci_local_build_repo/. /home/circleci/project
cp: cannot stat '/tmp/_circleci_local_build_repo/.': No such file or directory
Error: Exited with code 1
Step failed
Error: runner failed
Task failed

Which I believe is also documented here: Not copied hidden files on local build by circleci cli

I’m using the latest update:

Build-agent version 0.0.7725-9681bc36 (2018-08-09T15:10:50+0000)

Is there anything I can do about that other than just pushing my changes and seeing if it’s just a local issue as other post for that error have been?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.