Banging my Head on Docker (MacOS)

So I wasn’t having any luck with Node, and thought I’d try spinning up Docker to give the Photostructure server instance a try. Thought I had it but I’m getting an error at startup

Your library directory, /ps/library, is not read/write/execute by user photostructure (userid 501)
The owner of this directory is userid 0, g`0````0```
Please fix the permissions for this bind mount and restart the container.

UID 501 does match my Mac UID so that makes sense. What doesn’t is that it is saying the owner of this directory is uid 0 gid0 which I assume is on the docker side. the start script I used is right from the doc while I test this out:

#!/bin/bash

PSLIBRARY=“$HOME/photostructure_docker” # < CHANGE THIS LINE
mkdir -p “$PSLIBRARY”

IMG=“photostructure/server:alpha”
docker pull $IMG
docker run
–name photostructure
–detach
–restart unless-stopped
–stop-timeout 120 # < gives PhotoStructure 2 minutes to shut down cleanly.
–publish 1787:1787
-e TZ=“${TZ:-$(cat /etc/timezone)}”
-e PUID=“$(id -u)”
-e PGID=“$(id -g)”
-v “$PSLIBRARY”:/ps/library
-v “$HOME”/tmp/foobar:/pictures/ # < EXAMPLE: CHANGE THIS LINE
“$IMG”

When I look in Docker at my environment, I see the following so I’m seeing the PUID of 501
“Env”: [
“TZ=”,
“PUID=501”,
“PGID=20”,
“PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/photostructure:/opt/photostructure/tools/bin”,
“NODE_VERSION=20.11.1”,
“YARN_VERSION=1.22.19”,
“NODE_ENV=production”

When I look at my actual director permissions I see:
drwxr-xr-x 4 me staff 128 Apr 24 18:45 photostructure_docker

I’m lost. Thoughts?

Well I still have no idea what my issue was but I just used Portainer to set it up and it works fine. If anyone sees something I messed up above, please let me know.

Sorry you’re seeing so many setup issues!

This will only work if the script is run by the user you want to adopt – if you run the script with sudo, id -u will return 0.

Did you fix this?

I wasn’t running it with SUDO though, that’s why the UID 0 had me confused. Still does. I could not figure out how I was running as root. Oh well, Portainer fixed that. Started right up when I built the container that way with no issues.

1 Like