How to apply the restart setting to a multiple container executor

Hi there,

I am trying to change my config file in order to run tests using a multiple docker executor, according to https://circleci.com/docs/2.0/executor-types/#using-multiple-docker-images

In particular, I am launching cassandra, redis, etherpad and ethercalc, each on its container. However, ethercalc and etherpad currently exit imediately because the database takes a while to set up. I usually overcome this the wrong way, meaning that I run them with “restart: always” (using docker-compose), which relaunches the docker a second time (or a third) until the database is listening for connections and the services run as expected.

My question is: is there a way to tell CCI to restart the images? To be clear, what I would like to do is something like this:

jobs:
  test:
    docker:
      # Primary container image where all steps run.
      - image: "node:10-alpine"
      - image: "redis:3.2.8-alpine"
      - image: "oaeproject/oae-elasticsearch-docker"
      - image: "oaeproject/oae-cassandra-docker"
      - image: "oaeproject/oae-etherpad-docker:next"
        restart: always
      - image: "oaeproject/oae-ethercalc-docker:next"
        restart: always

Thank you in advance.

There is no way to use the restart key within the CircleCI configuration.

For this specific used case, I would suggest using docker-compose on a machine executor instead of trying to do this within the default CircleCI docker executor.

Ok, thanks for the reply. I will fix the boot sequence of those containers and try that way. I’m trying to avoid using compose because tests are slower and it takes me around 30m to run all tests.

Thanks anyway.

This sounds like a sticking-plaster over the problem anyway. The usual fix for waiting for a server to start up is to wait in a loop until a networking command says the port has been opened. There are commands available that will help you do that, e.g. dockerize.

1 Like

Indeed it is. I’ll be fixing it soon. Thanks for the suggestion.

1 Like

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