Connecting a freshly built container to one of the existing ones


The examples and content on Discuss are showing how to use an existing MySQL image from the primary container. Though I would like to connect to it from a freshly build container and I can’t figure how.

version: 2
      - image: circleci/python:2.7.13
      - image: library/mysql:5.7.17
            - MYSQL_ROOT_HOST=%
    working_directory: ~/project
      - checkout
      - setup_remote_docker

      - run: |
          sudo apt-get -q update
          sudo apt-get -q install -y mysql-client
          # Here i can connect to MySQL on using mysql

      - run: |
            docker build -t base -f ./docker/Dockerfile.base .
            docker run --network host  --name test base tail -f /dev/null
            # Here i can't connect to MySQL on using mysql inside the freshly running environment


You can’t. Bring up a new MySQL container in the same network as base.

closed #3

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