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

Using --user flag causes issues since 16.5.1 #14

Closed
cascornelissen opened this issue Jun 10, 2022 · 9 comments
Closed

Using --user flag causes issues since 16.5.1 #14

cascornelissen opened this issue Jun 10, 2022 · 9 comments

Comments

@cascornelissen
Copy link

We use this container for visual testing in combination with Storybook and we're seeing an issue since a few days where the entire starting of the container seems to fail.

  • satantime/puppeteer-node:16 does not work
  • satantime/puppeteer-node:16.15.1 does not work
  • satantime/puppeteer-node:16.15.0 does work

We pull the image, create the container, add a file, and finally start the container using something similar to the snippet below.

docker pull satantime/puppeteer-node:16
docker create --name example --user "${DOCKER_USER}" --mount "type=bind,source=${PWD},destination=/app" --workdir "/app" --rm satantime/puppeteer-node:16 /bin/sh -c "/bin/sh /app/.jest/start.sh ${JEST_OPTIONS}"
docker cp ${NPMRC_FILE} example:/.npmrc
docker start --attach example

This references a start.sh which, among other things, runs npm rebuild. When I mentioned the container is not working I meant that this file is executed but nothing in it seems to do, or at least output anything.

Passing DOCKER_USER is needed for our Bamboo CI/CD setup and is generated using the command below, resulting in something like 501:20.

DOCKER_USER := $(shell echo $$(id -u):$$(id -g)) 

Removing the --user flag fixes the issue locally but prevents our CI/CD setup from working correctly. Did something change between 16.5.0 and 16.5.1 that could cause this? I can't seem to locate any changelog and the history isn't helping either 😅

@satanTime
Copy link
Owner

Hi.

Thanks for the report.

Nothing has been changed in the build script. Maybe the base node image got some breaking changes with 16.5.1 and in its chain: 16.5 and 16.
Or I updated docker and it builds differently now.

I'll take a look at the weekend if there is something to do from my side.

@satanTime
Copy link
Owner

Hi @cascornelissen, could you check how it behaves when you use the original node@16.5.1 image? It's clear that puppeteer is going to fail, but interesting to check whether the container can be created and executed.

@cascornelissen
Copy link
Author

cascornelissen commented Jun 16, 2022

Looks like the problem is indeed related to node:16.15.1, I get pretty much the same crash-y output when using that version but Storybook starts running without issues when using node:16.15.0.

This is not my area of expertise at all but it seems similar to nodejs/docker-node#1734?

andrey-skl added a commit to JetBrains/ring-ui that referenced this issue Jun 17, 2022
@satanTime
Copy link
Owner

Hi @cascornelissen, there was an update of 16.5.1 images, could you check whether it has fixed your issue?

@cascornelissen
Copy link
Author

@satanTime, just checked and I'm still seeing the same issue with the latest version of 16.15.1, unfortunately.

@cascornelissen
Copy link
Author

Just did some testing and the requirement our CI/CD pipeline had earlier with regards to file ownership was loosened up a bit so we apparently don't need the --user flag anymore. So for now, for us at least, we can use the latest version again but the original issue still exists.

@satanTime
Copy link
Owner

I changed your code a bit for testing, and on my mac, I was able to execute npm install && npm rebuild with a changed user:

docker pull satantime/puppeteer-node:16
cd ~/project/simple-node
DOCKER_USER=501:20 docker create --name example --user "${DOCKER_USER}" --mount "type=bind,source=${PWD},destination=/app" --workdir "/app" --rm satantime/puppeteer-node:16 /bin/sh -c "npm install && npm rebuild"
docker start --attach example

The output on npm install:

> postinstall
> husky install

husky - Git hooks installed

added 19 packages, changed 1 package, and audited 2064 packages in 6s

259 packages are looking for funding
  run `npm fund` for details

9 vulnerabilities (7 high, 2 critical)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
npm notice
npm notice New minor version of npm available! 8.11.0 -> 8.13.2
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.13.2>
npm notice Run `npm install -g npm@8.13.2` to update!
npm notice

The output on npm rebuild:

rebuilt dependencies successfully

Maybe, somehow permissions under .npm were messed up.

@cascornelissen
Copy link
Author

Yeah, it's definitely a permission issue on the .npm directory. Again, I'm ok with closing this issue as this seems to be covered upstream by nodejs/docker-node#1734. But I can also imagine it makes sense to keep it open here so others can find it faster, I'll leave that decision up to you ❤️

@satanTime
Copy link
Owner

Thanks for the update. I'm going to close the ticket, because it is still searchable.

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

2 participants