question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Checkout Action fails in container where image has defined USER

See original GitHub issue

Describe the bug

When using an image in container directive, if the image has defined a USER in the Dockerfile from which it was built, then the Checkout Action will fail since access to the repo is denied to user.

To Reproduce

Steps to reproduce the behavior:

  1. Go to test repo: https://github.com/ronilan/gh-actions-container-user-bug/
  2. Inspect Dockerfiles in: https://github.com/ronilan/gh-actions-container-user-bug/tree/main/.github/docker
  3. Run the Build Docker Images Action: https://github.com/ronilan/gh-actions-container-user-bug/actions/workflows/docker-node.yml
  4. Run Container Matrix Checkout Action: https://github.com/ronilan/gh-actions-container-user-bug/actions/workflows/container.yml

Clone repo for further inspection/cases.

Five images are used. Three are from Dockerhub. Two were built using local Dockerfiles.

  • node:16
  • node:16-alpine3.14
  • ghcr.io/ronilan/gh-actions-container-user/node:16-alpine3.14-user
  • ghcr.io/ronilan/gh-actions-container-user/node:16-user
  • bitnami/laravel

Expected behavior

All Checkouts in matrix succeed.

Runner Version and Platform

Current runner version: ‘2.278.0’ Operating System Ubuntu 20.04.2 LTS Virtual Environment Environment: ubuntu-20.04 Version: 20210712.0 Included Software: https://github.com/actions/virtual-environments/blob/ubuntu20/20210712.0/images/linux/Ubuntu2004-README.md Image Release: https://github.com/actions/virtual-environments/releases/tag/ubuntu20%2F20210712.0

What’s not working?

Images where USER has been defined in Dockerfile fail the checkout step.

  • node:16
  • node:16-alpine3.14
  • ghcr.io/ronilan/gh-actions-container-user/node:16-alpine3.14-user
  • ghcr.io/ronilan/gh-actions-container-user/node:16-user
  • bitnami/laravel

Job Log Output

Annotations
3 errors
job1 (ghcr.io/ronilan/gh-actions-container-user-bug/node:16-user)
The process '/usr/bin/git' failed with exit code 1
job1 (ghcr.io/ronilan/gh-actions-container-user-bug/node:16-alpine3.14-user)
EACCES: permission denied, open '/__w/gh-actions-container-user-bug/gh-actions-container-user-bug/ee081242-d865-45c5-8d69-2f00db47372f.tar.gz'
job1 (bitnami/laravel)
EACCES: permission denied, open '/__w/gh-actions-container-user-bug/gh-actions-container-user-bug/a074f4b8-f278-4a5f-a7da-96f62313ed1f.tar.gz'
Screen Shot 2021-07-20 at 11 22 19 AM

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:5
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
ronilancommented, Jul 28, 2021

It does seem to be expected.

This is for the Docker container action. While the underlying behavior (and code?) may be shared, it wouldn’t really be what one would expect from the container directive.

Being unable to use any image that has USER defined (such as Bitnami images) extends beyond the documented platform limitations.

0reactions
nikola-jokiccommented, Mar 17, 2023

Hey @zoete,

Sorry for the late reply. The uid on the hosted machine is 1001. If you use uid 1001, the problem should disappear. This has been a known issue for a while: #434 I will close this one since it is a duplicate, but feel free to comment on it ☺️

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use github actions/checkout@v2 inside own docker ...
I have my own php image, which I would like to use for my project to run tests on. container: rela589n/doctrine-event-sourcing-php:latest ...
Read more >
Introduction to GitHub Actions
This tutorial walks you through the process of setting up and using Docker GitHub Actions for building Docker images, and pushing images to...
Read more >
Multi-platform image with GitHub Actions
To solve this issue you can use a matrix strategy to distribute the build for each platform across multiple runners and create manifest...
Read more >
A guide to using act with GitHub Actions
If your GitHub Action job specifies an image to use, it will pull the image and run it in the act container to...
Read more >
Hello Docker CI / CD - Github Actions
Your container image is already in the cloud, so deploying it to cloud ... In this case, we will use action checkout to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found