bundles/docker-engine: support different user, arbitrary mapped volumes, custom command

This commit is contained in:
Franzi 2025-02-16 18:35:54 +01:00
parent e0903ffa50
commit f04149b4a7
Signed by: kunsi
GPG key ID: 12E3D2136B818350
2 changed files with 25 additions and 9 deletions

View file

@ -12,8 +12,8 @@ then
exit 1
fi
PUID="$(id -u "docker-${name}")"
PGID="$(id -g "docker-${name}")"
PUID="$(id -u "${user}")"
PGID="$(id -g "${user}")"
if [ "$ACTION" == "start" ]
then
@ -32,10 +32,19 @@ then
--publish "127.0.0.1:${host_port}:${container_port}" \
% endfor
% for host_path, container_path in sorted(volumes.items()):
% if host_path.startswith('/'):
--volume "${host_path}:${container_path}" \
% else:
--volume "/var/opt/docker-engine/${name}/${host_path}:${container_path}" \
% endif
% endfor
--restart unless-stopped \
% if command:
"${image}" \
"${command}"
% else:
"${image}"
% endif
elif [ "$ACTION" == "stop" ]
then