Named Images in the setup


#1

As part of my build process I have the following block:

  - run:
      name: Startup Testing dockers (e.g. Postgres, Redis)
      command: |
        docker run -d --name postgres -e POSTGRES_PASSWORD=xyzzy postgres:9.6
        docker run -d --name redis redis:3.2

I would like to migrate this to the build/docker/image section, however I don’t see a way to assign name attributes to the containers. Specifically when I hit my test phase I have the following lines.

docker run --link postgres:postgres.local.dev --link redis:redis.local.dev ${CONTAINER_IMAGE} \
            npm run create-test-db

However I don’t see a way to assign a name to something in the docker image section, ideally it would be something like:

docker:
  - image: docker:17.03.0-ce-git
    environment:
      CONTAINER_IMAGE=payment-rails/api

  - image: postgres:9.6
    name: postgres
    environment:
      POSTGRES_PASSWORD: 1234

  - image: redis:3.2
    name: redis

#2