What if you are building a huge project which involves multiple scripts, multiple environment variables, multiple actions which has to be performed on a container as we are running a Jenkins job.
Yes, we can run Jenkins job with docker container as its agent.
Lets see on how can we do so in below steps.
- Composing a docker image
- Spinning up the container using docker compose
- Jenkins agent setup
Composing docker image
Assuming that docker has been installed on the host machine, will jump into the creation of docker image to bring up the container and run it as Jenkins agent.