I’m hoping to be able to simplify my docker volume bind mounts. Let me iterate out three scenarios:
Scenario 1: Compose volume snippet below, and I run mkdir on the library, tmp, config, and logs folders before bringing the container up.
volumes:
- $MEDIADIR/photos:/photos
- $DOCKERDIR/photostructure/library:/ps/library
- $DOCKERDIR/photostructure/tmp:/ps/tmp
- $DOCKERDIR/photostructure/config:/ps/config
- $DOCKERDIR/photostructure/logs:/ps/logs
Everything works great and as intended, just like the instructions suggest. While there’s certainly nothing wrong with that, and it’s even ideal for people who may be putting the library or tmp folders in different locations, I’m wondering if it’s possible to keep it shorter.
Scenario 2: Do not pre-create the subfolders of tmp, library, config, and logs in the mapped photostructure folder, but I use the same volume snippet as above, I get the following:
Creating photostructure ... done
2021-06-23T23:13:59.289032548Z Error: code ENOENT: ENOENT: no such file or directory, open '/ps/config/PhotoStructure/settings.toml'
2021-06-23T23:13:59.289117763Z Error: ENOENT: no such file or directory, open '/ps/config/PhotoStructure/settings.toml'
2021-06-23T23:13:59.294037486Z {"fatal":true,"exit":true,"status":14,"pid":28,"ppid":21,"error":"main setup failed: Error: code ENOENT: ENOENT: no such file or directory, open '/ps/config/PhotoStructure/settings.toml'¹"}
Could the config directory (and possibly others) be created upon container startup?
Scenario 3: Shorten the volume bind mounts, and do not pre-create subfolders.
I’d like to change my volume mapping to the following.
volumes:
- $MEDIADIR/photos:/photos
- $DOCKERDIR/photostructure:/ps
However, this results in the following error:
Creating photostructure ... done
2021-06-23T23:27:41.076308081Z [FATAL tini (7)] exec /ps/app/docker-entrypoint.sh failed: No such file or directory
2021-06-23T23:27:42.606503888Z [FATAL tini (7)] exec /ps/app/docker-entrypoint.sh failed: No such file or directory
Would it be possible to build an option to allow the /ps
directory to be mounted directly, but perhaps utilize an environmental variable to have the /ps/app
location not be bind mounted? Or is there a different way to simplify the bind mount folder structure under a config subdirectory of some kind, such that /ps/config
was the parent for tmp, logs, config, and possibly library?
Thanks for your thoughts.