Introduction
It is by now a normal setup to have the build agents on a CI/CD-pipeline (e.g. TeamCity) using Docker containers to quick and easily create the environments required to run a desired build step.
Therefore, it is also normal that these Docker containers require some debugging when setting up the build steps.
This is a short guide for how to enter a docker container with the exactly same environment as the build agent (e.g. work directory and environmental variables.)
Step 1: Find information from (failed?) build
Find the build job, which you would like to investigate. We are intending to enter that specific build job’s work
folder to have the exact same configurations.
When the build job has been found, we enter the “Build
log” and find the intended build step. Different build steps may use different Docker containers.
Step 2: Extract Docker snippets
We need to extract the following snippets from the build log’s “Docker initialization”-section:
- Volume: A declaration working folder will be attached to the Docker container and therefore available within the container. This is relevant to reproduce the exact same conditions as the CI/CD-pipeline.
Should look something like this: