-
I have just started experimenting with the CI/CD functionality of GitHub Actions, and I fail to understand the “runs-on” and “container” options.
Please excuse me if I am getting something totally the wrong way… I started experimenting with CI/CD only a couple of days ago. Thanks in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
> Why both “runs-on” and “container” are required when I want to run a container, and what exactly does this mean? Let’s say for example that I have “runs-on: ubuntu-latest” and “container: centos-latest”. Does this mean that my requested centos-latest image will run on an ubuntu-latest virtual machine? Why do I even have to specify the host operating system (ubuntu-latest) if I plan to use a container and do everything I want to do there? Yes, you’re exactly right - that’s what that means. You need to specify that because the underlying virtual machine dictates the type of containers that you can run. You need an underlying Windows virtual machine (ie, Since we don’t know what type of container you’re trying to run until we download it, we can’t let you skip specifying a virtual machine type. (We need to provision a virtual machine just to do that download.) > What if someone wants to create a build matrix with different containers? To my understanding this is not possible at the moments because the build matrix somehow works only with the “runs-on” option. That’s possible - there’s nothing special about the runs-on key in a matrix. A matrix is really only variable substitution. To use a matrix of different containers, you can:
|
Beta Was this translation helpful? Give feedback.
-
Excellent explanation! Thank you so much my friend! |
Beta Was this translation helpful? Give feedback.
-
Searching for exactly this explination - many thanks for explaining so cleanly |
Beta Was this translation helpful? Give feedback.
> Why both “runs-on” and “container” are required when I want to run a container, and what exactly does this mean? Let’s say for example that I have “runs-on: ubuntu-latest” and “container: centos-latest”. Does this mean that my requested centos-latest image will run on an ubuntu-latest virtual machine? Why do I even have to specify the host operating system (ubuntu-latest) if I plan to use a container and do everything I want to do there?
Yes, you’re exactly right - that’s what that means.
You need to specify that because the underlying virtual machine dictates the type of containers that you can run. You need an underlying Windows virtual machine (ie,
runs-on: windows-latest
) to use Wi…