-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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-compose with minimal PID namespace and non-root permissions #2397
Conversation
…stead of the entire host PID namespace.
I just realized another thing, please don't merge yet. |
…rs in favour of erigon user in Dockerfile. Adapted Makefile to pre-create mounted volumes to avoid permission issues at runtime.
…(1000:1000) regardless of the user that invoked the make command.
I told with MDBX author. He said:
can you try idea “processes in different containers must have different PID”? |
As I remember - using non-root user in Docker makes it very complicated to get inside container. Is it true? |
Right now we have:
This looks like when running without docker except there are only the three listed processes. So basically erigon and rpcdaemon share the same process namespace and both processes have different PIDs although running in separate containers. erigon is started first so it obtains the file lock. It looks like rpcdaemon is getting a shared-lock but I need to debug it more to understand how this could break now. Re non-root user: you can always override it with |
Do you know where the PID is saved for the locking in mdbx ? No, but probably in .lock file - in same dir with mdbx.dat |
“ can always override it” - yes, just unclear when need override and when don’t |
What do you mean by that ? What would you like me to test ? |
All good. Will test mac tomorrow |
@AskAlexSharov |
@AskAlexSharov fixed it 🎆 |
Makefile
Outdated
@@ -22,8 +23,12 @@ docker: | |||
docker build -t turbo-geth:latest --build-arg git_commit='${GIT_COMMIT}' --build-arg git_branch='${GIT_BRANCH}' --build-arg git_tag='${GIT_TAG}' . | |||
|
|||
docker-compose: | |||
# Uses host's PID,UID,GID. It required to open Erigon's DB from another process (RPCDaemon local-mode) | |||
UID_GID=$(shell id -u):$(shell id -g) docker-compose up | |||
@if test -n "$(XDG_DATA_HOME)"; then \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you sure we need create folders manually?
On mac folders auto-created under my user (not root).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e.g. https://github.com/mariuspod/erigon/blob/devel/docker-compose.yml#L10
The left part of the second colon is the local volume path which is expanded and created as root user on linux.
This is causing permission issues later on, that's why I'm pre-creating them with the non-root user on the host so that the volume can just pick it up and not change the permissions at runtime.
@mariuspod , any profit from supporting ERIGON_HOME if we already support XDG_DATA_HOME? |
@AskAlexSharov |
perfecto |
What I did
erigon
andrpcdaemon
which is sufficientHow I did it
make docker-compose
now takes care of creating the initial docker volume sub-directorieserigon
,erigon-grafana
anderigon-prometheus
I've also created a
erigon
user in the Dockerfile and using the same UID:GID combination for the prometheus and grafana containers.Results
XDG_DATA_HOME
setI hope this will be useful in 90% of the cases 😂