Best way to start a docker container during a task


In many of our projects that we continuously integrate with Concourse, we use TestContainers library to create various disposable containers in integration tests. Some examples include Postgres, Redis, Localstack. There containers are destroyed (by the library) once tests are finished.

Till now we’ve been really running “Docker in Docker”:

  • Alpine based on github concourse/docker-image-resource/blob/master/assets/
  • Ubuntu based on github jpetazzo/dind

After update to Concourse 5.0 / “overlay” worker baggage claim driver, Docker daemon is no longer able to start.
After I applied for our Alpine solution it worked, but for Ubuntu I still have to find a solution.

Next to it, running “Docker in Docker” is not recommended (e.g., here:

I am wondering what would be a recommended approach to spin up docker containers during builds on CI that would be forward compatible?



A workaround is to still use btrfs on worker by add --baggageclaim-driver=btrfs. But with 5.0.0, concourse binary seems no longer embed btrfs and mkfs.btrfs binaries, if your worker doesn’t contain those two binary files, you may have to manually install them, then use --baggageclaim-btrfs-bin= and --baggageclaim-mkfs-bin= to specify paths of them.



@evanchaoli, thanks for the workaround.
For now, I can probably follow commits on to have a working solution for Alpine. However, I think the idea is to have it deprecated eventually and get/build images without Docker actually running.
For Ubuntu setup, I’ll probably still have to fix it myself.

But I was wondering more about the long term approach, so that I don’t need to apply fixes now and then when new version of Concourse comes out.
I think there should be quite some teams out there that use Docker for spinning up resources during (integration) tests as a part of build scripts (maven, Gradle, …) to ensure quicker feedback when running both on developers machines and in CI.
Ideally, I would like to have a task configuration similar to Travis CI:
- task: build image: jdk file: git/ci/tasks/build.yml timeout: 30m services: [docker] ...
(with DOCKER_HOST passed to the task, e.g.).



this is an ongoing gap in concourse today: for more info