Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elphel393-docker
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Elphel
elphel393-docker
Commits
bdca0c5a
Commit
bdca0c5a
authored
Mar 02, 2026
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Auto-fallback to sg docker when daemon access is denied
parent
715edc29
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
0 deletions
+28
-0
run_docker.sh
scripts/run_docker.sh
+28
-0
No files found.
scripts/run_docker.sh
View file @
bdca0c5a
...
@@ -11,6 +11,34 @@ else
...
@@ -11,6 +11,34 @@ else
exit
1
exit
1
fi
fi
has_docker_group
()
{
id
-nG
|
tr
' '
'\n'
|
grep
-qx
docker
}
can_access_docker_daemon
()
{
docker info
>
/dev/null 2>&1
}
if
!
can_access_docker_daemon
;
then
if
[[
"
${
RUN_DOCKER_SG_FALLBACK
:-
0
}
"
!=
"1"
]]
\
&&
command
-v
sg
>
/dev/null 2>&1
\
&&
has_docker_group
;
then
printf
-v
REEXEC_CMD
'%q '
"
$0
"
"
$@
"
exec
sg docker
-c
"RUN_DOCKER_SG_FALLBACK=1
${
REEXEC_CMD
}
"
fi
if
has_docker_group
;
then
echo
"ERROR: cannot access Docker daemon from this shell."
>
&2
echo
"Hint: run 'newgrp docker' in this shell, or rerun with:"
>
&2
echo
" sg docker -c '
$0
${
*
:-}
'"
>
&2
else
echo
"ERROR: user '
$(
id
-un
)
' is not in docker group."
>
&2
echo
"Run once as sudo, then re-login:"
>
&2
echo
" sudo usermod -aG docker
$(
id
-un
)
"
>
&2
fi
exit
1
fi
if
docker compose version
>
/dev/null 2>&1
;
then
if
docker compose version
>
/dev/null 2>&1
;
then
COMPOSE
=(
docker compose
)
COMPOSE
=(
docker compose
)
elif
command
-v
docker-compose
>
/dev/null 2>&1
;
then
elif
command
-v
docker-compose
>
/dev/null 2>&1
;
then
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment