'Run script before getting prompt in singularity shell
I have built a Docker container with a Docker file that ends with WORKDIR /where/I/will/work and when I spin up the container, I can get to work. Unfortunately, my remote system won't allow Docker containers, so I converted it to a singularity container. Everything works great, except that it drops me into a bind of my local directory, which is not where I want to be.
singularity shell --bind /different/src/dir:/a/dest/dir my_image.sif
This does almost everything I want, except for the aforementioned starting directory.
I'd like to run a script just after entering the shell that is simply cd /where/I/want/to/be. There are a couple of questions with answers that no longer work because the meaning of the -c flag has changed.
I will also accept and answer that has me make a change to the Dockerfile, but I don't know what that could be because the Docker image works like I want it to.
Solution 1:[1]
From the documentation on singularity shell, the way to get what I want is to do
singularity shell --bind /different/src/dir:/a/dest/dir --pwd /where/I/want/to/be my_image.sif
The help message has it hidden a little bit under -p/--pid and mentions payloads and such that make it seem like it does something different. I suspect that help is common with the exec command where the language would make more sense.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Finncent Price |
