<p>Yes your understanding is correct. The full documentation is here <a href="https://docs.github.com/en/actions/using-jobs/running-jobs-in-a-container" rel="nofollow noreferrer">https://docs.github.com/en/actions/using-jobs/running-jobs-in-a-container</a></p>

CC BY-SA 4.0
2022-10-11T21:23:40.137Z
2022-10-11T21:23:40.137Z
Levi
<ol>
<li><p>We should have docker images in the dockerhub. if we require customized docker image we can create docker image using the docker file</p>
</li>
<li><p>We can create application.yml files by using github actions workflow.</p>
</li>
<li><p>Application.yaml file for docker containers looks like this:</p>
</li>
</ol>
<p>name: container # Workflow-name</p>
<p>on: push #when a push is made to branch in the workflow's repository</p>
<p>jobs: # Actionsto be performed after push happened</p>
<p>node-docker:</p>
<pre><code>runs-on: ubuntu-latest# Running OS on which actions will be performed 

container: 

  image: node:14.15.0-alpine3.12 # docker-image-tag, it will pull from Dockerhub and container get created 
</code></pre>

CC BY-SA 4.0
2022-11-17T06:07:18.167Z
2022-11-17T06:07:18.167Z
Nitor Infotech
<p>Creating a Dockerfile
In your new hello-world-docker-action directory, create a new Dockerfile file. Make sure that your filename is capitalized correctly (use a capital D but not a capital f) if you're having issues. For more information, see &quot;Dockerfile support for GitHub Actions.&quot;</p>
<p>Dockerfile</p>
<pre><code># Container image that runs your code
FROM alpine:3.10

# Copies your code file from your action repository to the filesystem path `/` of the container
COPY entrypoint.sh /entrypoint.sh

# Code file to execute when the docker container starts up (`entrypoint.sh`)
ENTRYPOINT [&quot;/entrypoint.sh&quot;]
</code></pre>
<p>Creating an action metadata file
Create a new action.yml file in the hello-world-docker-action directory you created above. For more information, see &quot;Metadata syntax for GitHub Actions.&quot;</p>
<p>action.yml</p>
<pre><code>YAML
# action.yml
name: 'Hello World'
description: 'Greet someone and record the time'
inputs:
  who-to-greet:  # id of input
    description: 'Who to greet'
    required: true
    default: 'World'
outputs:
  time: # id of output
    description: 'The time we greeted you'
runs:
  using: 'docker'
  image: 'Dockerfile'
  args:
    - ${{ inputs.who-to-greet }}
</code></pre>
<p>This metadata defines one who-to-greet input and one time output parameter. To pass inputs to the Docker container, you should declare the input using inputs and pass the input in the args keyword. Everything you include in args is passed to the container, but for better discoverability for users of your action, we recommended using inputs.</p>
<p>GitHub will build an image from your Dockerfile, and run commands in a new container using this image.</p>

CC BY-SA 4.0
2022-09-11T12:32:49.857Z
This appears like an answer generated by some poorly trained AI model. The question was "Is that correct?". So, is it?
Greendrake
CC BY-SA 4.0
2023-05-17T16:55:58.083Z
Or rather a copy from the Github manual.
Kamiccolo
CC BY-SA 4.0
2022-09-11T12:15:59.710Z
2022-09-11T12:15:59.710Z
Iman Jafari
<p>Consider this GA workflow:</p>
<pre class="lang-yaml prettyprint-override"><code>name: My GA Workflow

on: push

jobs:
  myJobName:
    runs-on: ubuntu-latest
    container: cypress/included:10.6.0
    steps:
      - name: Ensure tools are available
        shell: bash
        run: |
          apt-get update &amp;&amp; \
          apt-get install -y unzip zstd netcat

    # and so on...
</code></pre>
<p>I would like to have a crystal clear understanding what happens there. Currently I reckon:</p>
<ol>
<li>GA will run a <code>ubuntu-latest</code> virtual machine with docker engine pre-installed.</li>
<li>It will pull and run <code>cypress/included:10.6.0</code>.</li>
<li><em>All</em> the steps will run inside the Cypress docker container, not on the Ubuntu machine.</li>
</ol>
<p>Is that correct?</p>

CC BY-SA 4.0
2022-09-11T11:06:01.130Z
This seems to be covered in the Github docs: https://docs.github.com/en/actions/using-jobs/running-jobs-in-a-container
Ben Cottrell
<docker><github-actions><workflow>
How does Github Actions work with docker containers?
Greendrake
# How does Github Actions work with docker containers?

(Asked by: username_0 on 2022-09-11)

Consider this GA workflow:
name: My GA Workflow

on: push

jobs:
  myJobName:
    runs-on: ubuntu-latest
    container: cypress/included:10.6.0
    steps:
      - name: Ensure tools are available
        shell: bash
        run: |
          apt-get update && \
          apt-get install -y unzip zstd netcat

    # and so on...

I would like to have a crystal clear understanding what happens there. Currently I reckon:

GA will run a ubuntu-latest virtual machine with docker engine pre-installed.
It will pull and run cypress/included:10.6.0.
All the steps will run inside the Cypress docker container, not on the Ubuntu machine.

Is that correct?

**Tags:** docker, github-actions, workflow

> **Comments:**
> **username_1**: This seems to be covered in the Github docs: https://docs.github.com/en/actions/using-jobs/running-jobs-in-a-container  

---

## 3 answers

### Answer by username_2 on 2022-10-11. Score: 2 | Accepted answer

Yes your understanding is correct. The full documentation is here <https://docs.github.com/en/actions/using-jobs/running-jobs-in-a-container>


---

### Answer by username_3 on 2022-11-17. Score: 0

We should have docker images in the dockerhub. if we require customized docker image we can create docker image using the docker file

We can create application.yml files by using github actions workflow.

Application.yaml file for docker containers looks like this:


name: container # Workflow-name
on: push #when a push is made to branch in the workflow's repository
jobs: # Actionsto be performed after push happened
node-docker:
runs-on: ubuntu-latest# Running OS on which actions will be performed 

container: 

  image: node:14.15.0-alpine3.12 # docker-image-tag, it will pull from Dockerhub and container get created


---

### Answer by username_4 on 2022-09-11. Score: -1

Creating a Dockerfile
In your new hello-world-docker-action directory, create a new Dockerfile file. Make sure that your filename is capitalized correctly (use a capital D but not a capital f) if you're having issues. For more information, see "Dockerfile support for GitHub Actions."
Dockerfile
# Container image that runs your code
FROM alpine:3.10

# Copies your code file from your action repository to the filesystem path `/` of the container
COPY entrypoint.sh /entrypoint.sh

# Code file to execute when the docker container starts up (`entrypoint.sh`)
ENTRYPOINT ["/entrypoint.sh"]

Creating an action metadata file
Create a new action.yml file in the hello-world-docker-action directory you created above. For more information, see "Metadata syntax for GitHub Actions."
action.yml
YAML
# action.yml
name: 'Hello World'
description: 'Greet someone and record the time'
inputs:
  who-to-greet:  # id of input
    description: 'Who to greet'
    required: true
    default: 'World'
outputs:
  time: # id of output
    description: 'The time we greeted you'
runs:
  using: 'docker'
  image: 'Dockerfile'
  args:
    - ${{ inputs.who-to-greet }}

This metadata defines one who-to-greet input and one time output parameter. To pass inputs to the Docker container, you should declare the input using inputs and pass the input in the args keyword. Everything you include in args is passed to the container, but for better discoverability for users of your action, we recommended using inputs.
GitHub will build an image from your Dockerfile, and run commands in a new container using this image.

> **Comments:**
> **username_0**: This appears like an answer generated by some poorly trained AI model. The question was "Is that correct?". So, is it?  
> **username_5**: Or rather a copy from the Github manual.  

---

