Running docker integration test containers while dev containers running

I have a Makefile that looks like this:

dev:
    docker-compose up -d --build

test:
    DOCKER_ENV="-test" docker-compose up -d --build
    // run some integration tests on the containers then
    // shut them down (and let ephemeral database disappear)
    DOCKER_ENV="-test" docker-compose down -v

And my docker-compose looks like this:

  • How to activate docker 1.12 in terminal without Moby the whale app on Mac
  • How to _directly_ COPY files to “Program Files (x86)” folder in a Windows container?
  • docker redis -Can't open the log file: No such file or directory
  • exit all supervisord processes if one exited
  • Canonical way to checksum downloads in a Dockerfile?
  • Correct way to detach from a container without stopping it
  • services:
      foo:
        container_name: foo${DOCKER_ENV}
        image: foo:latest
      bar:
        container_name: bar${DOCKER_ENV}
        image: bar:latest
    

    When I try to run make dev and then make test the latter causes the dev containers to be rebuilt with the new name (“-test”) rather than create an entire separate set of containers—which is what I want.

    How can I keep the dev environment running and periodically spin up the test environment? (We’ll do this on CI at some point, but I want developers to be able to locally run all the tests.)

  • Install Firefox on Tinycore (Docker)
  • Connecting to a Remote EJB Module running in Docker
  • Docker windows loading kernel modules
  • How to use wait_for in a two node cluster docker container deployment?
  • MPI in docker container over docker network hangs
  • How restart a stopped docker container
  • One Solution collect form web for “Running docker integration test containers while dev containers running”

    Use the docker-compose project name to separate dev from test, e.g.:

    dev:
        docker-compose up -d --build
    
    test:
        export DOCKER_PROJ=`basename \`pwd\``"-test"
        docker-compose -p ${DOCKER_PROJ} up -d --build
        // run some integration tests on the containers then
        // shut them down (and let ephemeral database disappear)
        docker-compose -p ${DOCKER_PROJ} down -v
    

    (My Makefile syntax is a little rusty, I’m sure there are cleaner ways to do that.)

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.