docker image assumes uid/gid and fails
wtfrank opened this issue · 0 comments
wtfrank commented
I set up an account on a machine
When I run the container I get the following error:
2024/02/09 20:29:08 screeps-launcher ()
2024/02/09 20:29:08 Loaded config from config.yml
2024/02/09 20:29:08 Installing Node
2024/02/09 20:29:08 Downloading https://nodejs.org/dist/v12.22.12/node-v12.22.12-linux-x64.tar.gz...
2024/02/09 20:29:08 200 OK
2024/02/09 20:29:08 downloaded 0/23131523 bytes (0.00%)
2024/02/09 20:29:08 Download failed: open node-v12.22.12-linux-x64.tar.gz: permission denied
2024/02/09 20:29:08 node-v12.22.12-linux-x64.tar.gz
2024/02/09 20:29:08 node-v12.22.12-linux-x64
2024/02/09 20:29:08 rename deps/node-v12.22.12-linux-x64 deps/node: no such file or directory
This problem is caused by hardcoding differ uids/gids in the Dockerfile
RUN groupadd --gid 1000 screeps \
&& useradd --uid 1000 --gid screeps --shell /bin/bash --create-home screeps \
&& mkdir /screeps && chown screeps.screeps /screeps
On my machine I happen to have different gids
$ id -a
uid=1002(screeps) gid=1001(screeps) groups=1001(screeps),137(docker)
I edited the dockerfile to have the uids/gids from my user, built and tagged the container, then I was able to get further with starting the container