actions / container-action

MIT License
185 stars 41 forks source link

Please expose `--privileged` flag in action.yaml config #2

Closed meeDamian closed 10 months ago

meeDamian commented 4 years ago

I want to setup a CPU emulation action for Docker, however I can't currently do that due to the lack of access to this flag.

chrispat commented 4 years ago

The —privileged flag is heavily dependent on the configuration of the underlying docker daemon and depending on the configuration for the particular runner it may or may not work.

iamenr0s commented 3 years ago

do you have any update? it would be very useful to pass down the --privileged option

lion24 commented 3 years ago

Hello guys,

I'm having the same issue. I have a docker container that is used as an build environment but need --privileged mode to be enabled.. Too bad, I cannot used GitHub actions and used this container to build other projects that needs it..

I will try to find another solution..

brad-natelborg commented 3 years ago

This behavior is very much needed. Currently a deal breaker for some of our CI systems.

brad-natelborg commented 3 years ago

OK, just figured this out!

You need to add an "options: --privileged" to the CI yml under your container.

ianfixes commented 3 years ago

You need to add an "options: --privileged" to the CI yml under your container.

Can you show an example of this in context?

brad-natelborg commented 3 years ago

@ianfixes yep, sure thing.

smoke:
    name: Smoke Test MAX32665
    needs: [load, ci-image]
    runs-on: [self-hosted, linux, x64]

    # Run inside this container
    container:
      image: <docker image name>
      credentials:
        username: _json_key
        password: ${{ secrets.GCR_DEVOPS_SERVICE_ACCOUNT_KEY }}
      options: --privileged

    steps:
      - name: Check out the repo
        uses: actions/checkout@v2
ncalteen commented 10 months ago

Hello! Apologies for the delay in responding to this issue. It looks like @brad-natelborg provided a solution for running a container in privileged mode within a workflow run :)

Regarding creating a container based action with the same configuration, as @chrispat mentioned, this is heavily dependent on the underlying docker daemon.

I am going to go ahead and close this out for the time being, but if there are additional questions please feel free to reopen!

mirabilos commented 7 months ago

@brad-natelborg where do I specify this for a job which only uses a container in one step?

(This is for “slim” containers where the normal checkout action cannot run in the container because it has no nodejs.)