[Linux] Bind mounted volume destination directory missing from shell scripts

I have successfully mounted a volume like so:

sudo docker run -it --name mark -v /home/mark/Downloads/wine-tkg-git:/wine-tkg ubuntu_image

The volume will be used for compiling programs. There are are several sub-directories that need to remain in order for the compilation scripts to work. The thing I don’t understand is that the destination directory (“wine-tkg”) is missing when these shell scripts are called. I get a “cannot locate file” error because the destination directory isn’t passed to the scripts. How do I correct this? I’ve tried the following two command and they don’t fix it:

sudo docker run -it --name mark -v /home/mark/Downloads/wine-tkg-git/:/wine-tkg ubuntu_image
sudo docker run -it --name mark -v /home/mark/Downloads/wine-tkg-git:/wine-tkg/ ubuntu_image

Note the trailing forward slashes. Why don’t the scripts “see” the working directory of the mount. I’ve net searched a bunch and turned up nothing.

Can share the offending command in the entrypoint script of the container and how the exact error message looks like?

Here’s the error output:

root@8ba98545ea7d:/home/mark/Downloads/docker# /wine-tkg/wine-tkg-git/non-makepkg-build.sh
/wine-tkg/wine-tkg-git/non-makepkg-build.sh: line 61: /home/mark/Downloads/docker/wine-tkg-scripts/prepare.sh: No such file or directory
/wine-tkg/wine-tkg-git/non-makepkg-build.sh: line 62: /home/mark/Downloads/docker/wine-tkg-scripts/build.sh: No such file or directory
 -> Non-makepkg build script will be used.

/wine-tkg/wine-tkg-git/non-makepkg-build.sh: line 67: _init: command not found
/wine-tkg/wine-tkg-git/non-makepkg-build.sh: line 90: _pkgnaming: command not found
 -> Cloning and preparing sources... Please be patient.

The script is not being passed “/wine-tkg/wine-tkg-git/”

It works if I cd into the target directory. Is that a Linux thing? I’m pretty new to Linux.

This seem to be a scoping problem. A scripted called by its full path, will still use the current dir as working dir, except the script is design to detect its basepath and adds it to all commands that needs it.

Based on the shared information, the only thing I can say for sure is that the script is used in a way it is not supposed to be used. Since I don’t know the script - and you didn’t share it - it is impossible to guess where a different turn needs to be made.

I don’t know. The compilation works when changing directories to the target directory of the build script. It’s probably standard practice with Linux (like I said I’m new–only been suing Linux for a few months). Before I started using Docker, that’s the way I would compile my builds.

it’s this! Not a docker problem at all. But rather the result of a design decitions someone took while writing the script.

At least you get it working now.

Gotcha. Not a Linux thing then, but a script writer thing. Heck, I don’t know. It’s working now, so me happy.

Thanks, @meyay

A Linux thing that happens if the script writer doesn’t know better, doesn’t care or simply doesn’t think of the scenerio.

I bet the writer just doesn’t care or is lazy. He knows his stuff. If I were to do it, it would be a deficiency on my part, but I think this dev knows what to do. I bet he was just lazy.

It looks like you were right:

Darn it, I don’t know what the heck I’m doing. I want to be a competent coder, but I’ve only coded consecutively for 6 months and there’s a lot to learn. Plus, I have to learn Linux, which is way more command line based than Windows. My brain is melting down. It already doesn’t work well.

/venting done/