Steps are not executed correctly when being ran in image built in previous job (from Github Packages) #24960
-
Hey! It’s a bit difficult to find a good title for this issue (which might be the reason I didn’t find any solution for my problem through Google yet…) I’m building a very simple image in the first job of my workflow:
This image is pushed to Github packages and I am able to pull it locally and run commands inside the corresponding container as expected, in this case
However, when running the job in Github Actions, I get the following result: I added a simple My workflow looks like this:
The documentation for running code inside an own container isn’t too extensive, but I’ve used this flow in Gitlab CI for a long time with great results. Am I missing something really simple here? Thanks a lot in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Your Dockerfile sets this:
Stex:
So If you want to run the things in |
Beta Was this translation helpful? Give feedback.
-
Looks like I’ve been too spoiled by Gitlab where everything just works as expected (and every command is ran inside the same container).
solved the problem for me.
airtower-luna:
You are right, it does. I missed that Thanks a lot for your help, maybe an actual example of how to properly use own, pre-built images in actions would make a good addition to the documentation. |
Beta Was this translation helpful? Give feedback.
Your Dockerfile sets this:
So
/app
is where your data ends up. However, when you use a container image for a job (as in your second job) settings like working directory or entrypoint are ignored. The actions runner mounts the job workspace into the container and uses that as the working directory. The logs for the “Initialize containers” step should show you all the Docker arguments that are used to start the container.If you want to run the things in
/app
within the container you’ll need to change the directory, either as part of your step or using theworking-directory
keyword.