Search code examples
bashshpodman

podman "/bin/sh: 1: ./runModel.sh: not found"


I have a Dockerfile

FROM ubuntu:18.04

RUN apt-get update && apt-get install -yq build-essential autoconf libnetcdf-dev libxml2-dev libproj-dev valgrind wget unzip git nano

# pulls ADBM from github and unzips in folder ADMBcode
RUN mkdir /ADMBcode 
RUN wget https://github.com/admb-project/admb/releases/download/admb-12.2/admb-12.2-linux.zip
RUN mv admb-12.2-linux.zip /ADMBcode
RUN unzip ADMBcode/admb-12.2-linux.zip -d /ADMBcode

# pulls hydra repo from github into folder HYDRA
RUN mkdir /HYDRA
RUN git clone https://github.com/NOAA-EDAB/hydra_sim.git /HYDRA

WORKDIR /HYDRA

# incase of windows stuff
RUN chmod -R 777 /HYDRA
   
# compile the model
RUN /ADMBcode/admb-12.2/admb hydra_sim.tpl


CMD ./runModel.sh

It installs software, pulls from Github, and compiles a model, then it should execute a shell script.

If i use the command

podman run imageName

then all seems to run ok. i can enter the container and type ./runModel.sh and i can confirm the model runs.

But if i type

podman run --mount "type=bind,src=/path_to_input_files/,dst=/HYDRA/" imageName

where the path_to_input_files contains two files hydra_sim.dat and hydra_sim.pin i get the error

/bin/sh: 1: ./runModel.sh: not found

This file (runModel.sh) exists in the WORKDIR (it is part of the cloned repo). But if i add it to the path_to_input_files directory that is mounted i still get the same error.

What am i missing here? Thanks


Solution

  • When you run:

    podman run --mount "type=bind,src=/path_to_input_files/,dst=/HYDRA/" imageName
    

    You are replacing the contents of /HYDRA with the contents of /path_to_input_files. Anything else that was included in that directory in the image is no longer accessible.

    That means in particular that /HYDRA/runModel.sh is not available.

    The fix is to mount your input files at another location.