The compose yml, see below, should use it to define a volume but the container fails to bind it. If the absolute path is used, then binding works. $HOME also works. $(readlink) in turn fails.
How to modify: - ${BLOCK}/SimNet/examples:/examples
to bind an external hard disk to the container?
Yes, I can reproduce the substitution using config. However, when I enter the container, go to /test and ls, then no files are visible as opposed to providing the full path in .yml. Having parsed the files, that should not be possible. Looks like a bug.
Here is a simpler container to reproduce the problem:
Though above the /mnt/xxx parts look alike, they are not exactly the same? In your last post it seems that $BLOCK was actually /mnt/103bdk77-3b0b-4baa-8473-d2c5b5384ab5/BLOCK, which apparently worked when used in the absolute path as quoted from the first post above (but not in the last post). So I guess the mount name and the value of $BLOCK simply changed during testing, but you may want to make sure.
Thank you - well spotted $BLOCK is identical but was manually modified for the forum; however, that makes no sense, so I started to copy and pasted the real value.
That is: for a moment I thought I could reproduce your simpler test case, but my mount did not have a /test folder, so then for me ${BLOCK}/test should be empty indeed. Fixing that to use a different folder in the export BLOCK=, I get the expected results. (On a Mac, using /Volumes/xxx rather than /mnt/xxx.)
Why did you think readlink may help?
(Aside: your simpler use case also works for a symbolic link, for me.)
I followed your remark using a symlink called BLOCK in conjunction with the full path:
- /home/user/BLOCK/SimNet/examples:/examples
which also works. This is also the solution for a Portainer Stack that only substitutes environment variables when linked to a git repository (good to know).