Access files put to the custom image

Eugene Simonov December 3, 2019

I use custom docker image from a private registry as a build environment in one of my pipeline's steps. This image contains some files which I would like to access during the step execution. However, when I enter the step and execute the `ls` command, all I see is the content of my repository.

To be precise, my backend service and integration tests reside in separate repositories. My pipeline is triggered by pull requests in the backend repository. In order to run integration tests in the pipeline, I `COPY`ed my tests to the image that I use as a build environment. Now, when I enter the step with integration testing, I cannot execute `./gradlew clean test`, getting 'no such file or directory' exception.
Can I access the files put to my custom image? Do they necessarily have to be present in the repo that runs the pipeline?

1 answer

0 votes
mgarcia June 29, 2022

I thinks this is an old question and maybe it has been solved. But I've came across this question because I faced the same problem.

Finally, my solution was to change to the directory where I placed everything in the container's image. I mean, in the Dockerfile I had specified a `WORKDIR` (let's say `/my-dir`) and there I have everything that the container stores.

So then, in the step that executes from this image, you should do a:

cd /my-dir

So that you are in the image folder that contains everything stored there.

I hope this can help you (if you haven't solve it yet by your own) or anyone that is facing the same problem.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events