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:

  • Trying to transfer big file docker container Error response from daemon: ApplyLayer exit status 1 stdout: stderr: unexpected EOF
  • How to change dockers default network?
  • Can't build openjdk:8-jdk image directly
  • Assigning docker container to a recieved from outside port with Python
  • how to set file and dir permissions on docker when developing
  • Docker Compose env_file in Multicontainer Elastic Beanstalk
  • 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.)

  • gem: command not found
  • how to cross docker-compose.yml file to link container
  • Installing Docker.io on Ubuntu 14.04LTS
  • docker0 interface missing on osx
  • Allow docker container to connect to a local/host postgres database
  • Sample docker compose setup for web application devops
  • 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.