Skip to content

RANGER-5559: fixes to docker container startup as non-root user and/or hostname as non "ranger"#922

Open
sneethiraj wants to merge 2 commits intoapache:masterfrom
sneethiraj:RANGER-5559
Open

RANGER-5559: fixes to docker container startup as non-root user and/or hostname as non "ranger"#922
sneethiraj wants to merge 2 commits intoapache:masterfrom
sneethiraj:RANGER-5559

Conversation

@sneethiraj
Copy link
Copy Markdown
Member

As startup script is trying to move files into /etc/init.d and /usr/bin, it is throwing lot of errors.
Also, having hardcoded hostname as ranger during service creation causes more errors during startup.

What changes were proposed in this pull request?

Those steps that requires root permission WILL run only if you are a root. This will be required for non-docker setp.
Also, ranger service creation script uses the current hostname to identify the service instead of hardcoded 'ranger'

How was this patch tested?

Build and deployed as a docker container in Linux Microk8s environment. It deploys fine with no errors.

…t user and also fixed hardcoded hostname in create service script
@sneethiraj sneethiraj self-assigned this Apr 17, 2026
if not current_host_name:
current_host_name = "ranger"

ranger_client = RangerClient('http://' + current_host_name + ':6080', ('admin', 'rangerR0cks!'))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given this script is executed in the container running ranger admin service, it seem call to socket.gethostname() is not necessary; simply using localhost would work, right?

import sys

ranger_client = RangerClient('http://ranger:6080', ('admin', 'rangerR0cks!'))
skipMe = os.getenv("SKIP_CREATE_SAMPLE_SERVICES","false").lower() == "true"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sneethiraj - for developer testing, I think it is okay to create services during Ranger admin startup. However, this change would be useful in the official docker image released to docker hub, which is built from https://github.com/apache/ranger-tools/tree/main/release.

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.

2 participants