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

Use containers as non root users #94

Merged
merged 12 commits into from
Jun 23, 2024

Conversation

Carbrex
Copy link
Member

@Carbrex Carbrex commented Jun 10, 2024

Fixes #92
Use containers as non root users, so that the files are owned by the current user not root users.
Maybe other containers like lila_ws, lila_search, etc also need to use this.

The current folders created as root users should be deleted first before running these.

@Carbrex
Copy link
Member Author

Carbrex commented Jun 10, 2024

# cd into lila-docker
sudo rm -rf .pnpm-store
cd repos
sudo find . -name target -type d -prune -exec rm -rf {} ;
sudo find . -name node_modules -type d -prune -exec rm -rf {} ;
cd ./lila
sudo rm -rf logs .bloop .pnpm-store .sbtopts
sudo find . -name dist -type d -prune -exec rm -rf {} ;
sudo find . -name tsconfig.tsbuildinfo -type f -exec rm -rf {} ;
cd ../lila-ws
sudo rm -rf logs

First check which all folders are owned by root

find <path-to-lila-docker> -type d -user root -prune

If you are sure you want to delete these then, run

sudo find <path-to-lila-docker> -type d -user root -prune -exec rm -rf {} \;

To remove files owned by root remove -type d from the given command.
Script to delete files and folders created as root users by those containers.
If someone doesnt have root access they might want to run these command in some container as root user and map lila-docker dir into it.

@Carbrex
Copy link
Member Author

Carbrex commented Jun 18, 2024

These are all the dirs owned by root https://pastebin.com/g714SN3c

Check which files are owned by root

docker run -v .:/lila-docker -w /lila-docker alpine:latest sh -c "find /lila-docker -user root -prune"

DONT RUN THIS IF YOU HAVE DOCKER DESKTOP

To remove all these files if you dont have sudo access you can run

docker run -v .:/lila-docker -w /lila-docker alpine:latest sh -c "find /lila-docker -user root -prune -exec rm -rf {} \;"

@Carbrex

This comment has been minimized.

@Carbrex
Copy link
Member Author

Carbrex commented Jun 21, 2024

Everything should work now. Except search-ingestor image which will be fixed by #98.

@Carbrex Carbrex marked this pull request as ready for review June 21, 2024 19:26
@fitztrev fitztrev merged commit 540e47c into lichess-org:main Jun 23, 2024
2 checks passed
@Carbrex Carbrex deleted the non-root-containers branch July 4, 2024 13:23
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

Successfully merging this pull request may close these issues.

fix sbt image for docker engine people
2 participants