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:

  • Use docker run command to pass arguments to CMD in Dockerfile
  • How to disable icc including published ports in Docker
  • Running Integration tests from a Docker image for Java project
  • Running composer on Elastic Beanstalk with multi docker environment
  • mysql source command do nothing inside docker container
  • how to “docker run” a shell session on a minimal linux install and immediately tear down the container?
  • 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.)

  • Ensure docker daemon is running on the host in script file
  • AWS ECS Error when running task: No Container Instances were found in your cluster
  • How to back up docker swarm mode service configuration for disaster recovery
  • gcloud docker — push vertificate error
  • Docker and UFS filesystem
  • azk - How to increase a VM memory in azk?
  • 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.