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

Doesn't detect docker even though its installed and in PATH #3025

Open
coolaj86 opened this issue May 6, 2024 · 3 comments
Open

Doesn't detect docker even though its installed and in PATH #3025

coolaj86 opened this issue May 6, 2024 · 3 comments

Comments

@coolaj86
Copy link

coolaj86 commented May 6, 2024

Update: Possible Solutions

Rather than instructing the user to use sudo prematurely, the install script could detect whether or not the current user has permissions to the docker group, or ask the user if they really want to sudo:

if ! groups | grep -q docker; then
    echo "$(id -u -n) is not a member of the group 'docker'"
    echo "Possible solutions:"
    echo "    sudo useradd '$(id -u -n)' 'docker' ; bash ./install.sh"
    echo "Or"
    echo "    sudo bash ./install.sh"
fi

Or

g_sudo=''
if ! groups | grep -q docker; then
    echo "$(id -u -n) is not a member of the group 'docker'"
    printf "Run using 'sudo'? [y/N] "
    read g_use_sudo
    if test "$g_use_sudo" = "y" || test "$g_use_sudo" = "yes"; then
        g_sudo='sudo'
    fi
fi
$g_sudo docker ...

In either case, if sudo is selectively used only for things that need sudo, it is less likely to cause permission or environment-related issues.

Self-Hosted Version

24.4.2

CPU Architecture

x86_64

Docker Version

25.0.5

Docker Compose Version

2.26.1

Steps to Reproduce

command -v docker
/home/app/.local/opt/docker/bin/docker
VERSION="24.4.2"
git clone https://github.com/getsentry/self-hosted.git
cd ./self-hosted/
git checkout ${VERSION}
sudo ./install.sh
HEAD is now at 935a683 release: 24.4.2
� Parsing command line ...

� Detecting Docker platform
FAIL: Could not find a `docker` binary on this system. Are you sure it's installed?

Expected Result

Should detect docker from the current PATH.

Actual Result

Used something other than PATH.

Event ID

No response

@coolaj86
Copy link
Author

coolaj86 commented May 6, 2024

What I actually had done was this:

sentry-install.sh:

# Assuming current latest version is 24.1.0
# Current actual version can be acquired from the Releases page on GitHub
VERSION="24.4.2"
git clone https://github.com/getsentry/self-hosted.git
(
        cd self-hosted || exit 1
        git checkout "${VERSION}"
        sudo ./install.sh
)
sh ./sentry-install.sh

By happenstance while debugging I manually went into ./self-hosted/ and ran bash ./install.sh (not sudo) and now it's gotten much further:

Relay credentials written to relay/credentials.json.

� Generating secret key ...
Secret key written to sentry/config.yml

� Fetching and updating Docker images ...

and still going

So this issue is probably related to trying to using sudo where it isn't needed.

Possible Solution

This should probably instead checking that the current user has permissions to docker rather than trying to elevate permissions prematurely:

if ! groups | grep -q docker; then
    echo "$(id -u -n) is not a member of the group 'docker'"
    echo "Possible solutions:"
    echo "    sudo useradd '$(id -u -n)' 'docker' ; bash ./install.sh"
    echo "Or"
    echo "    sudo bash ./install.sh"
fi

@azaslavsky
Copy link
Contributor

Good solution.

I think we'd welcome a PR to this effect if you'd be so inclined!

@getsantry
Copy link

getsantry bot commented May 29, 2024

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@getsantry getsantry bot added the Stale label May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Waiting for: Community
Status: No status
Development

No branches or pull requests

2 participants