I’d like to use docker compose in a gitlab cicd workflow – essentially I want to be able to do something like,
docker-compose run webapp manage test
The webapp service would have a dependency, say, on postgres. Postgres would automatically start in a container, tests would run, and then ideally, postgres container would shutdown as the run exits.
In other words, the service dependencies only run during the duration of the ‘run’ command.
Is this a workflow that is supported in some way? How do you support this kind of workflow? Is the only way around this to do a docker-compose down after the “run” completes?
I’m looking for a workflow that is least likely to leave orphan containers running…