0
votes

I am using the Docker Pipeline Plugin to have each Jenkins job run in a container. Each of my Jenkins jobs will run a docker-compose build. If I run many concurrent jobs, the docker-compose commands may conflict with each other. I understand that I could have each build use some unique string as the name for the docker network, or as the name/tag for the docker-compose build command, but I am hoping for a solution that does not require this. Perhaps there is a way to "namespace" each Jenkins Job container such that none of their resources can be shared?

1

1 Answers

1
votes

You could generate a custom project name (for example commit id and/or job number) so the resources created by the compose file are unique and guessable. This way you don't need to modify the compose file itself not move it to another location.

docker-compose will recognize either the COMPOSE_PROJECT_NAME environment variable or you could pass it as an argument, for example docker-compose -p ${MY_UNIQUE_ID} build.