-
Notifications
You must be signed in to change notification settings - Fork 58
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
Allow for a non-root user #28
Comments
I just thought I would add. If I try to do this by just adding the
Virtuoso will run as the non-root user inside the container and the files created by virtuoso in the /data/ directory share the same UID and GID as the host user, but the virtuoso.sh script fails to provide a lot of it's functionality. See logs below:
|
There's a significant discrepancy between the elderly Also, your initial report was pulling from I wonder whether your |
You are correct. The See the output from docker logs using the actual latest Docker Image below:
The
I apologize for the oversight in providing proper information. |
This would be great because of Openshift |
@BashfulBandit @amalic - I cannot provide much insight on this, but I wonder whether you have tried with OpenLink's image? |
@TallTed If this is available in the OpenLink image, then it is not documented and their Dockerfile is unavailable to look at to see. |
@pkleef - Can you provide any assistance here? |
Hey @BashfulBandit, we tend to use user namespaces to map root to a different user. If that isn't suitable for your purpose I guess you would have to modify virtuoso.sh to take into account the user specified. For example, you can change the settings dir by overwriting the |
Here is what I had to do to make that work. It might be a bit of a kluge, but it works for this. I haven't done thorough testing. Let me know if something doesn't work or if you need more info. The methods below are for a non-swarm situation. In swarm, I only had to set the user to be non-root in the compose file. Changing some of the moves to copies in virtuoso.sh helps a lot. I got around other permissions by mounting the settings directory. In this case, the making of the settings directory could be wrapped in an if statement like:
Here are the changes I made to virtuoso.sh. I didn't do the directory wrap (yet) in my environment.
Then, I added these volume mounts to my docker compose file. They assume you have made yourself a directory called 'virtuoso' in the same directory as your docker compose file.
For good measure, I also have a little script to run before starting things that will ensure that the settings directory and the two sql files are present but empty at startup. These bits could probably be put into the virtuoso.sh script, too. |
I am trying to extend your Virtuoso Docker Image to just include a non-root user to run Virtuoso in a Docker Container.
The purpose of this is to allow for the files generated by the Docker image in the /data directory, which I mount to my host in order to have persistent storage. The above Dockerfile simply created a group and a user inside the Docker Image with the same UID and GID as my user on my host machine and then tells Docker to use that User for any following instructions, which include ENTRYPOINT and CMD Dockerfile instructions, which I don't override. At container start up the parent Docker image's ENTRYPOINT and CMD will be run by my new, non-root User.
Unfortunately, I am having trouble with this because the virtuoso.sh script that is run as the CMD instruction requires and depends on the root user running it to create some files. I figured this out by checking the docker logs. This is my output from docker logs:
While Virtuoso still runs as the non-root user, the actions in the virtuoso.sh script do not behave correctly, so I am losing out on a lot of the functionality you have set up. For example, setting up a DBA_PASSWORD via environment variables to the Docker container and configuring the virtuoso.ini file via environment variables. As you can see, when I try to login with the DBA_PASSWORD I am expecting to work, it doesn't.
It may be as easy as just changing where the /settings directory, /settings/.config_set file, clean-logs.sh script, and sql-query.sql script are made, but that is just a guess based off the logs I provided.
If you have another idea/suggestion, please let me know as I would love to be able to run virtuoso as a non-root user in my environment.
The text was updated successfully, but these errors were encountered: