I'm getting stuck on a Dockerfile with:
[2/2] STEP 31/42: COPY /opt/SIMULATeQCD/src /simulateqcd/src
Error: error building at STEP "COPY /opt/SIMULATeQCD/src /simulateqcd/src": checking on sources under "/opt/SIMULATeQCD/podman-build": copier: stat: "/opt/SIMULATeQCD/src": no such file or directory
However, it does exist so I am baffled as to what podman is looking for:
[grant@simulateqcd podman-build]$ ls -al /opt/SIMULATeQCD/src
total 144
drwxr-xr-x. 12 grant grant 4096 Apr 14 16:23 .
drwxr-xr-x. 3 root root 25 Apr 14 16:20 ..
-rw-r--r--. 1 grant grant 52854 Apr 14 16:09 CMakeLists.txt
-rwxr-xr-x. 1 grant grant 126 Apr 14 16:09 cmake.sh
I've spent the better part of 45 minutes playing with the context, checking the permissions, turning off SELinux, and am at a loss as to what else to check. I've given it an absolute path everywhere I can think to look but it still says the path doesn't exist.
Everything is owned by 1000:1000 everywhere. Context directory is /opt/SIMULATeQCD, Dockerfile is in /opt/SIMULATeQCD/podman-build. I'm running the Dockerfile like this:
podman build \
--tag simulateqcd/simulateqcd:latest \
--label name=simulateqcd \
--build-arg CORES=${CORES} \
--build-arg RHEL_VERSION=${RHEL_VERSION} \
--build-arg CUDA_VERSION=${CUDA_VERSION} \
--build-arg USERNAME=${USERNAME} \
--build-arg GROUPNAME=${GROUPNAME} \
--build-arg USER_ID=${USER_ID} \
--build-arg GROUP_ID=${GROUP_ID} \
--build-arg DIRECTORY=$topdir \
-f $scriptdir/Dockerfile
/opt/SIMULATeQCD
Is there something else I'm missing maybe?
Update
The Dockerfile is here
COPY ./src /simulateqcd/src
COPY ./CMakeLists.txt /simulateqcd/CMakeLists.txt
COPY ./parameter /simulateqcd/parameter
COPY ./scripts /simulateqcd/scripts
COPY ./test_conf /simulateqcd/test_conf
The script is run from this line
podman build \
--tag simulateqcd/simulateqcd:latest \
--label name=simulateqcd \
--build-arg CORES=${CORES} \
--build-arg RHEL_VERSION=${RHEL_VERSION} \
--build-arg CUDA_VERSION=${CUDA_VERSION} \
--build-arg USERNAME=${USERNAME} \
--build-arg GROUPNAME=${GROUPNAME} \
--build-arg USER_ID=${USER_ID} \
--build-arg GROUP_ID=${GROUP_ID} \
--build-arg ARCHITECTURE=${ARCHITECTURE} \
--build-arg USE_GPU_AWARE_MPI=${USE_GPU_AWARE_MPI} \
--build-arg USE_GPU_P2P=${USE_GPU_P2P} \
--build-arg TARGET=${TARGET} \
-f $scriptdir/Dockerfile
$topdir
where $topdir = /opt/SIMULATeQCD and $scriptdir=/opt/SIMULATeQCD/podman-build. src is located at /opt/SIMUALTeQCD/src
Running ./simulateqcd build gets you:
Error: error building at STEP "COPY ./src /simulateqcd/src": checking on sources under "/opt/SIMULATeQCD/podman-build": copier: stat: "/src": no such file or directory
./simulate_qcd.sh: line 285: /opt/SIMULATeQCD: Is a directory
The two relevant aspects for the question are the
Dockerfilepath, which can be provided with the-foption and the build context, which is the last argument in the build command.When a context is set in the
podman buildcommand, all subsequentCOPYinstructions inside theDockerfileare relative to the context path.Assuming you have the following directory structure:
If you run the build command like this:
Then the
DockerfileshouldCOPYfiles as if the current working directory on the host machine was/opt/SIMULATeQCD/src:Now if you run the container, the two files should be found in the container: