Docker-compose - cannot create container

System information

  1. What operating system you’re using: Ubuntu
  2. What version Ubuntu 20.04 LTS
  3. What edition of PhotoStructure you’re using: PhotoStructure for Docker

A description of the bug

photostructure_1  | {"fatal":true,"exit":true,"status":14,"pid":15,"ppid":8,"error":"main setup failed: Error: code EACCES: EACCES: permission denied, open '/ps/config/settings.toml'¹"}
photostructure_1  | {"fatal":true,"exit":true,"status":14,"pid":16,"ppid":9,"error":"main setup failed: Error: code EACCES: EACCES: permission denied, open '/ps/config/settings.toml'¹"}
photostructure_1  | {"fatal":true,"exit":true,"status":14,"pid":15,"ppid":8,"error":"main setup failed: Error: code EACCES: EACCES: permission denied, open '/ps/config/settings.toml'¹"}
photostructure_1  | {"fatal":true,"exit":true,"status":14,"pid":16,"ppid":9,"error":"main setup failed: Error: code EACCES: EACCES: permission denied, open '/ps/config/settings.toml'¹"}
photostructure_1  | {"fatal":true,"exit":true,"status":14,"pid":14,"ppid":7,"error":"main setup failed: Error: code EACCES: EACCES: permission denied, open '/ps/config/settings.toml'¹"}
photostructure_1  | {"fatal":true,"exit":true,"status":14,"pid":15,"ppid":8,"error":"main setup failed: Error: code EACCES: EACCES: permission denied, open '/ps/config/settings.toml'¹"}
photostructure_1  | {"fatal":true,"exit":true,"status":14,"pid":14,"ppid":7,"error":"main setup failed: Error: code EACCES: EACCES: permission denied, open '/ps/config/settings.toml'¹"}
photostructure_1  | {"fatal":true,"exit":true,"status":14,"pid":17,"ppid":10,"error":"main setup failed: Error: code EACCES: EACCES: permission denied, open '/ps/config/settings.toml'¹"}
photostructure_1  | {"fatal":true,"exit":true,"status":14,"pid":14,"ppid":7,"error":"main setup failed: Error: code EACCES: EACCES: permission denied, open '/ps/config/settings.toml'¹"}
photostructure_1  | {"fatal":true,"exit":true,"status":14,"pid":15,"ppid":8,"error":"main setup failed: Error: code EACCES: EACCES: permission denied, open '/ps/config/settings.toml'¹"}
photostructure_1  | {"fatal":true,"exit":true,"status":14,"pid":14,"ppid":7,"error":"main setup failed: Error: code EACCES: EACCES: permission denied, open '/ps/config/settings.toml'¹"}
photostructure_1  | {"fatal":true,"exit":true,"status":14,"pid":15,"ppid":8,"error":"main setup failed: Error: code EACCES: EACCES: permission denied, open '/ps/config/settings.toml'¹"}
photostructure_1  | {"fatal":true,"exit":true,"status":14,"pid":13,"ppid":6,"error":"main setup failed: Error: code EACCES: EACCES: permission denied, open '/ps/config/settings.toml'¹"}

I’m new to docker, sorry. It looks like my user needs permissions for one of the required directories, but I thought I had sufficient permissions. Not sure.

Hey there, welcome to PhotoStructure!

It looks like the bind-mount for /ps/config isn’t quite right. It needs to point to a directory that already exists, and that your user can write to.

Can you post your docker-compose.yml?

I was wondering that. However,

~/.config/PhotoStructure
~/.config/PhotoStructure/logs
~/.config/PhotoStructure-docker

All exist. I should have privileges.

I also noticed under .config there’s both those two different photostructure folders. Is there a reason for two? I was just curious.

I do wonder if there’s a way to make docker-compose auto create the folders it needs. I thought my other containers do that, but I’m not sure.

Here is my docker-compose.yml. (I removed the watchtower section since I have watchtower running separately.) Thanks!

Make sure they’re writable by the user you’re running PhotoStructure as: your pastebin is pointing to user id 1000.

Is 1000:1000 correct?

Run id and verify the uid and gid are both 1000: if they aren’t, edit docker-compose.yml to match.

are those directories all writable by 1000:1000?

try touch $HOME/.config/PhotoStructure/example.txt

FWIW I just copied your docker-compose.yml and it works for me, changing the other paths. I’m using

~ ❯ docker-compose --version
docker-compose version 1.26.2, build eefe0d31

~ ❯ docker --version
Docker version 20.10.0, build 7287ab3

~ ❯ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.1 LTS"

Yes, current user is 1000:1000.

$ touch $HOME/.config/PhotoStructure/example.txt
$ ls $HOME/.config/PhotoStructure/example.txt

/home/chris/.config/PhotoStructure/example.txt

And I ran the other commands. I appreciate the assistance by the way:

$ docker-compose --version
docker-compose version 1.27.4, build 40524192

$ docker --version
Docker version 20.10.1, build 831ebea

$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.1 LTS"

Well dang. Is it the latest image? (it would only not be the latest if you’d pulled prior to v0.9.1 being released, which was back in November).

❯ docker pull photostructure/server
Using default tag: latest
latest: Pulling from photostructure/server
Digest: sha256:bfeef2d434df9d679e3873d78173cf1c1b031a973e7ed806e8fc443e005b90dd
Status: Image is up to date for photostructure/server:latest
docker.io/photostructure/server:latest

Yes it’s the latest. But I tried to docker-compose up again, and this time it reported that /tmp/photostructure-docker-tmp did not exist (and it did not), so I mkdir’d that and now the image actually seems to successfully load.

However, the web page isn’t loading. Docker-compose ps gives a “state” of “Restarting.”

And if I check docker-compose logs, I get a long string of the same:

photostructure_1  | {"fatal":true,"exit":true,"status":14,"pid":14,"ppid":7,"error":"main setup failed: Error: code EACCES: EACCES: permission denied, open '/ps/config/settings.toml'¹"}

Try running in the foreground with debugging.

Add this command: line:

version: "3.7"
services:
  photostructure:
    image: photostructure/server
    command: node /ps/app/photostructure main --verbose
...

And then run docker-compose up (without the --detach).

I found that my config dir actually had some files owned by root, as I’d been testing with and without the user: 1000:1000 assertion, so I had to

sudo chown -R 1000:1000 ~/.config/PhotoStructure-docker/

(Also: feel free to post the output here, or if there’s anything private, send me an email with the output and we can look at it together)

Okay, here is the verbose output.

This fixed it. The docker image seemed to successfully load and I can now pull up PhotoStructure WebUI.

Is there a way to have the container create all these folders and also assign ownership? I’m surprised anything under ~/ isn’t owned by the user. But I’m new to Linux.

Sure: a shell script could set this stuff all up automatically. Thanks for the suggestion :+1:

If you have any more questions or you find anything odd, confusing, or buggy, please let me know.

Hi again, sorry - when importing my library, the webUI responded with:

Failed to open library at /ps/library: permission denied, mkdir ‘/ps/tmp/sync-state-5nnm33edv1’: Library.setup() failed: unhandledRejection

/ps/library is bound to a directory I have permissions to, but I ran chown on it anyway to make sure.

Upon restarting the container, I got this again:

photostructure_1  | {"fatal":true,"exit":true,"status":12,"pid":14,"ppid":7,"error":"Library.setup() failed¹: Error: code EACCES: EACCES: permission denied, mkdir '/ps/tmp/sync-state-5nnm33edv1'"}
photostructure_1  | {"fatal":true,"exit":true,"status":14,"pid":14,"ppid":7,"error":"main setup failed: Error: code EACCES: EACCES: permission denied, mkdir '/ps/tmp/sync-state-5nnm33edv1': Library.setup() failed¹"}
photostructure_1  | {"fatal":true,"exit":true,"status":12,"pid":15,"ppid":8,"error":"Library.setup() failed¹: Error: code EACCES: EACCES: permission denied, mkdir '/ps/tmp/sync-state-5nnm33edv1'"}
photostructure_1  | {"fatal":true,"exit":true,"status":14,"pid":15,"ppid":8,"error":"main setup failed: Error: code EACCES: EACCES: permission denied, mkdir '/ps/tmp/sync-state-5nnm33edv1': Library.setup() failed¹"}
photostructure_1  | {"fatal":true,"exit":true,"status":12,"pid":14,"ppid":7,"error":"Library.setup() failed¹: Error: code EACCES: EACCES: permission denied, mkdir '/ps/tmp/sync-state-5nnm33edv1'"}
photostructure_1  | {"fatal":true,"exit":true,"status":14,"pid":14,"ppid":7,"error":"main setup failed: Error: code EACCES: EACCES: permission denied, mkdir '/ps/tmp/sync-state-5nnm33edv1': Library.setup() failed¹"}
photostructure_1  | {"fatal":true,"exit":true,"status":12,"pid":14,"ppid":7,"error":"Library.setup() failed¹: Error: code EACCES: EACCES: permission denied, mkdir '/ps/tmp/sync-state-5nnm33edv1'"}
photostructure_1  | {"fatal":true,"exit":true,"status":14,"pid":14,"ppid":7,"error":"main setup failed: Error: code EACCES: EACCES: permission denied, mkdir '/ps/tmp/sync-state-5nnm33edv1': Library.setup() failed¹"}
photostructure_1  | {"fatal":true,"exit":true,"status":12,"pid":15,"ppid":8,"error":"Library.setup() failed¹: Error: code EACCES: EACCES: permission denied, mkdir '/ps/tmp/sync-state-5nnm33edv1'"}
photostructure_1  | {"fatal":true,"exit":true,"status":14,"pid":15,"ppid":8,"error":"main setup failed: Error: code EACCES: EACCES: permission denied, mkdir '/ps/tmp/sync-state-5nnm33edv1': Library.setup() failed¹"}
photostructure_1  | {"fatal":true,"exit":true,"status":12,"pid":14,"ppid":7,"error":"Library.setup() failed¹: Error: code EACCES: EACCES: permission denied, mkdir '/ps/tmp/sync-state-5nnm33edv1'"}
photostructure_1  | {"fatal":true,"exit":true,"status":14,"pid":14,"ppid":7,"error":"main setup failed: Error: code EACCES: EACCES: permission denied, mkdir '/ps/tmp/sync-state-5nnm33edv1': Library.setup() failed¹"}
photostructure_1  | {"fatal":true,"exit":true,"status":12,"pid":14,"ppid":7,"error":"Library.setup() failed¹: Error: code EACCES: EACCES: permission denied, mkdir '/ps/tmp/sync-state-5nnm33edv1'"}
photostructure_1  | {"fatal":true,"exit":true,"status":14,"pid":14,"ppid":7,"error":"main setup failed: Error: code EACCES: EACCES: permission denied, mkdir '/ps/tmp/sync-state-5nnm33edv1': Library.setup() failed¹"}
photostructure_1  | {"fatal":true,"exit":true,"status":12,"pid":14,"ppid":7,"error":"Library.setup() failed¹: Error: code EACCES: EACCES: permission denied, mkdir '/ps/tmp/sync-state-5nnm33edv1'"}
photostructure_1  | {"fatal":true,"exit":true,"status":14,"pid":14,"ppid":7,"error":"main setup failed: Error: code EACCES: EACCES: permission denied, mkdir '/ps/tmp/sync-state-5nnm33edv1': Library.setup() failed¹"}

This time running chown -R 1000:1000 /tmp/photostructure-docker-tmp fixed it.

If you ran docker-compose up without the user directive, it would have run as root, and mucked up these permissions.

I actually changed the suggested /ps/tmp directory in the docker-compose template to not live in /tmp (hopefully that will help avoid this issue in the future for others!):

      - type: bind
        source: "${HOME}/.cache/photostructure"
        target: /ps/tmp
1 Like