Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker login failure on macos self hosted runner #566

Closed
nnsay opened this issue Jul 25, 2023 · 2 comments
Closed

docker login failure on macos self hosted runner #566

nnsay opened this issue Jul 25, 2023 · 2 comments

Comments

@nnsay
Copy link

nnsay commented Jul 25, 2023

Behaviour

Steps to reproduce this issue

  1. create self hosted runner with macos(arm)
  2. install the docker desktop on the macos runner
  3. change the runner of workflow to self-hosted and add the docker login step with docker/login-action@v2
  4. trigger the workflow

Expected behaviour

the docker login action is ok and the image on runner can be push to ghcr.io

Actual behaviour

docker does not login. But if change to self hosted runner to ubuntu-latest, the step is ok.

Configuration

  • Repository URL (if public): private
  • Build URL (if public): private
- name: Login to GitHub Container Registry
        uses: docker/login-action@v2
        with:
          registry: ghcr.io
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}

Logs

Run docker/login-action@v2
  with:
    registry: ghcr.io
    username: nnsay
    password: ***
    ecr: auto
    logout: true
  env:
    NODE_AUTH_TOKEN: ***
    NPM_CONFIG_USERCONFIG: /Users/vd/runner/runner1/_work/_temp/.npmrc
    NX_BASE: [2](https://github.com/Albedo-Inc/albedo-frontend/actions/runs/5651927180/job/15310874848#step:10:2)cb1d14582cef2ace[3](https://github.com/Albedo-Inc/albedo-frontend/actions/runs/5651927180/job/15310874848#step:10:3)f6d0668abeb808b7d8a29f
    NX_HEAD: beac76a3ab2eec7659f9b0e3501b[4](https://github.com/Albedo-Inc/albedo-frontend/actions/runs/5651927180/job/15310874848#step:10:4)e13aebce0[6](https://github.com/Albedo-Inc/albedo-frontend/actions/runs/5651927180/job/15310874848#step:10:6)4
  
Logging into ghcr.io...
Error: Error saving credentials: error storing credentials - err: exit status 1, out: `error getting credentials - err: exit status 1, out: `keychain cannot be accessed because the current session does not allow user interaction. The keychain may be locked; unlock it by running "security -v unlock-keychain ~/Library/Keychains/login.keychain-db" and try again``
@crazy-max
Copy link
Member

If you add a step right before login with:

- run: |
    security -v unlock-keychain ~/Library/Keychains/login.keychain-db

Does it work?

Also be careful because when using a self-hosted runner there would be concurrent access to the Docker config. See #173 (comment) for more info.

@gaborcsardi
Copy link

I hit the same issue. I run the self-hosted runner as a custom user, and the first issue was that this used did not have a login keychain.

It is possible that macOS will create the keychain if you log in with the user on the GUI. I created it from R: keyring::keyring_create("login").

The second issue is that the keychain must be unlocked. I did this from a terminal:

sudo -s
su <customuser>
security -v unlock-keychain ~/Library/Keychains/login.keychain-db

After this docker/login-action@v2 works on the self-hosted runner. HTH.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants