Running commands on docker container

Hi,

I have the following circle config:

    docker:
      # specify the version you desire here
      - image: circleci/php:7.1-browsers
      - image: swaggerapi/swagger-codegen-cli:2.4.5
      - image: circleci/mysql:5.7
        environment:
          MYSQL_ALLOW_EMPTY_PASSWORD: yes
          MYSQL_ROOT_PASSWORD: ''
          MYSQL_DATABASE: circleci
      # Specify service dependencies here if necessary
      # CircleCI maintains a library of pre-built images
      # documented at https://circleci.com/docs/2.0/circleci-images/
      # - image: circleci/mysql:9.4

    working_directory: ~/repo

swagger-codegen-cli is a CLI that I use to generate api sdk’s based off of my swagger documentation. Mysql is easy to use because it binds to port 3306, but I’m struggling with how to execute commands using that container. Any guidance you could give me would be fantastic

You can’t. Run steps will only run within the primary container, which is the first image listed in the config. All additional containers are only accessible via TCP/IP.

You’d want to get that CLI installed in the primary image.

I use that Swagger image too. The easiest way to run it is probably to install Docker in your primary container and then docker run it from there. Alternatively, you can install it by grabbing the jar file and installing Java, but Docker might be quicker :grinning: