-
Notifications
You must be signed in to change notification settings - Fork 266
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
Fixing Docker permission issues #2920
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.OpenSSF Scorecard
Scanned Files |
rmoreliovlabs
force-pushed
the
fix/docker_rsk_permission_issue
branch
from
January 10, 2025 00:28
f8c4f3b
to
4c117a1
Compare
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.
Explicit
rmoreliovlabs
force-pushed
the
fix/docker_rsk_permission_issue
branch
from
January 17, 2025 15:07
4c3f302
to
b9abb24
Compare
lucasvuotto
previously approved these changes
Jan 17, 2025
vincent89291
approved these changes
Jan 17, 2025
Vovchyk
approved these changes
Jan 20, 2025
fmacleal
previously approved these changes
Jan 20, 2025
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.
LGTM
Vovchyk
previously approved these changes
Jan 29, 2025
fmacleal
dismissed stale reviews from Vovchyk, lucasvuotto, and themself
via
January 29, 2025 12:03
20bc8e8
fmacleal
approved these changes
Jan 29, 2025
Quality Gate passedIssues Measures |
Vovchyk
approved these changes
Jan 30, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix User UID Conflict by Creating rsk User with UID 1000
Description
This PR fixes a problem where there was a UID conflict between files created by containers running with UID 1000 (like those created with the ARROWHEAD-6.3.0 image) and the new user created with UID 1001 in the updated image (ARROWHEAD-6.5.0). The issue happened when trying to access or modify files that were created by older versions of the container. Since the Dockerfile originally created the
rsk
user with a conflicting UID, any files created by the old container would have the wrong ownership, causing permission issues when a new container with a different UID tried to access them.To resolve this, I modified the
useradd
command to explicitly set thersk
user’s UID to 1000, which matches the UID used in the previous image. This ensures consistent file ownership across container versions and prevents the permission issuesHow I Tested the Fix:
Create a Boton Instance: I created a Boton instance to simulate the environment using the following command:
create mainnet commit fix/docker_rsk_permission_issue db reset duration 2 day
Stop the RSK Service: I stopped the existing RSK service with:
sudo systemctl stop rsk
Install Docker: I followed the Docker Install Guide for Ubuntu to install Docker on the system.
Start Docker:
sudo systemctl start docker
Build the Docker Image: In the
rskj
directory, I built the Docker image using the following commandscd rskj
sudo docker build -t testing-image .
Set Up DB Directory:
mkdir -p tmp/rskj-docker-repro
cd tmp/rskj-docker-repro
mkdir db
Run RSKJ with Newer Image (Before Fix): After building the new image with the fix, I tested it by running:
sudo docker run -it --rm -v ./db:/var/lib/rsk/.rsk rsksmart/rskj:ARROWHEAD-6.5.0
. This resulted in the following error when trying to create new files due to UID conflict after the upgrade to version 6.4.0 or later (which runs with UID 1001):2024-12-06-15:33:00.0579 ERROR [db] [main] While mkdir if missing: /var/lib/rsk/database/mainnet/unitrie: Permission denied org.rocksdb.RocksDBException: While mkdir if missing: /var/lib/rsk/database/mainnet/unitrie: Permission denied at org.rocksdb.RocksDB.open(Native Method) at org.rocksdb.RocksDB.open(RocksDB.java:252)
sudo docker run -it --rm -v ./db:/var/lib/rsk/.rsk testing
. The container started successfully, and no permission errors occurred.Types of changes
Checklist: