Fix: podman rootless user namespace volume mount

This commit is contained in:
brandtkeller 2022-02-03 12:47:12 -08:00
parent 4cb55a0026
commit c3feaacfd8

View File

@ -1,11 +1,16 @@
#!/bin/bash #!/bin/bash
VERSION=$(grep -oE "\"version\": \"(\w*.\w*.\w*.\w*.\w*.)" package.json | cut -d\" -f4) VERSION=$(grep -oE "\"version\": \"(\w*.\w*.\w*.\w*.\w*.)" package.json | cut -d\" -f4)
VOLUME_USERSPACE=""
CONTAINER_ENGINE=$1 CONTAINER_ENGINE=$1
if [ -z $CONTAINER_ENGINE ]; then if [ -z $CONTAINER_ENGINE ]; then
CONTAINER_ENGINE=docker CONTAINER_ENGINE=docker
elif [ $CONTAINER_ENGINE = "podman" ]; then
# rootless podman will require mounting the volume as its uid/gid internally for proper permissions
VOLUME_USERSPACE=":U"
fi fi
echo using $CONTAINER_ENGINE container engine... echo using $CONTAINER_ENGINE container engine...
echo Server now running at http://127.0.0.1:1880/
$CONTAINER_ENGINE run -p 1880:1880 -v "$(pwd)"/data:/home/appuser/.node-red sparkle-guide:$VERSION & $CONTAINER_ENGINE run -d -p 1880:1880 -v "$(pwd)"/data:/home/appuser/.node-red$VOLUME_USERSPACE sparkle-guide:$VERSION