Skip to content

Commit

Permalink
Specific error for socket permission
Browse files Browse the repository at this point in the history
As discussed here: #1054

If socket is not readable, for example when protected with SELinux and/or run as a rootless user, the existing error is deceptive. An additional error to check that it is readable before checking if it is a socket will clarify the problem. SELinux tip included for good measure.
  • Loading branch information
JohnMertz authored Sep 11, 2024
1 parent e15381b commit 517d594
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ function print_version {
function check_docker_socket {
if [[ $DOCKER_HOST == unix://* ]]; then
socket_file=${DOCKER_HOST#unix://}
if [[ ! -r $socket_file ]]; then
echo "Error: Docker host socket at $socket_file is not readable. Please check user permissions" >&2
echo "If you are in a SELinux environment, try using: '-v /var/run/docker.sock:$socket_file:z'" >&2
exit 1
fi
if [[ ! -S $socket_file ]]; then
echo "Error: you need to share your Docker host socket with a volume at $socket_file" >&2
echo "Typically you should run your container with: '-v /var/run/docker.sock:$socket_file:ro'" >&2
Expand Down

0 comments on commit 517d594

Please sign in to comment.