Service container: use the image built in the job #27147
-
Hello everyone, I’m new to Github actions and I’m experimenting with Docker Container Action and Service containers In brief, my workflow looks like this:
As per the official documentation, these images are pulled from docker hub. So, my questions are:
Thanks, Dinesh |
Beta Was this translation helpful? Give feedback.
Replies: 12 comments
-
v2.0yyd57ah8ihbek6u5mdi |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Thanks for the response. I can keep my quay repos public. Do you or the concerned team have plans to implement #1? Or do you have feature request to host a temporary container registry within GH actions in your roadmap? Also, I have a question unrelated to the original thread. Since the limitation provided by shared runners “might” not suffice my requirements to run multiple service containers, I was planning to use self-hosted runners. However, I was very worried about the warning provided. Do you have any plans to address these security concerns in your roadmap? My project is opensource and is prone for PRs from the community. If this question needs to be in a new thread, I can start one too :slight_smile: –Dinesh |
Beta Was this translation helpful? Give feedback.
-
Friendly followup, are there plans to implement #1? I’m facing the same issue except my images are private. For context, I’m running tests per each PR, this requires building images derived from the PR. |
Beta Was this translation helpful? Give feedback.
-
jcadavez:
How about running the images using Docker commands within the same job? I have a job that builds and runs container images for tests using Docker Compose. |
Beta Was this translation helpful? Give feedback.
-
That’s a good suggestion and I have tried it. But, I need to be able to access each container’s feeds via http://localhost:port. And some of my images are on Amazon ECR, so I don’t think I can pull them with service-containers jobs (thus why I build them) Unfortunately, the docs states that I have to use service-containers to access localhost. |
Beta Was this translation helpful? Give feedback.
-
jcadavez:
I don’t see it say that anywhere. You should be able to use You can use credentials when defining service containers, or |
Beta Was this translation helpful? Give feedback.
-
Sorry, my bad. It’s not in the docs, but I experienced it when I docker-compose w/o a service-container, and got this issue
I can try Amazon ECR. My last resort is pulling the image created per the PR branch repo. |
Beta Was this translation helpful? Give feedback.
-
For better context, let’s say there’s four services: A, B, C and D. They A -> B -> C -> D. But, I’ll be committing a PR for C’s repo. Each PR will trigger a GA Workflow that includes building C 's image with the others somehow per service-containers method. If I don’t, when I try accessing C 's localhost url, I’ll get the below error (thread).
|
Beta Was this translation helpful? Give feedback.
-
It’s hard to say what should or shouldn’t work without seeing your container setup, I’m afraid. One thing I can say is that Actions jobs set up their own network for |
Beta Was this translation helpful? Give feedback.
-
Thank you for your help so far Luna. I’ll look into your resource. If this provides more context, I added a template of my docker-compose.yml below. Each of them except the db images have a repo. They depend on each other as follows C -> B + A -> db I start my GA workflow like below:
I keep getting the
|
Beta Was this translation helpful? Give feedback.
-
From the compose file connecting to localhost:3333 should work, assuming the service doesn’t fail to start during some other issue. I think any further analysis would need at least the workflow (to see if there’s any bug there), and ideally logs. |
Beta Was this translation helpful? Give feedback.
The answer is no.
You could publish your image to quay.io during GitHub workflow execution. You could run docker commands to login to quay.io and then upload image to it.
If your quay.io registry is a publlic one, it could be used in service container image key. If it is a private one, there is no way to provide…