So I have a dockerfile and create an image from it that I need to use to run a script from aws batch, I've made the compute environment, the job definition and the job queue, and when I run the job it returns an error like this:
CannotStartContainerError: ResourceInitializationError: failed to create new container runtime task: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "mnt/app/export_script.sh": stat mnt/app/export_script.sh: no such file or directory: unknown
Here is the dockerfile for reference:
FROM oraclelinux:8
ARG release=19
ARG update=20
RUN dnf -y install oracle-release-el8 && \
dnf install unzip && \
dnf -y install oracle-instantclient${release}.${update}-basic oracle-instantclient${release}.${update}-devel oracle-instantclient${release}.${update}-tools oracle-instantclient${release}.${update}-sqlplus && \
rm -rf /var/cache/dnf
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && unzip awscliv2.zip && ./aws/install
WORKDIR /app
COPY /scripts/* /app/
RUN chmod +x /app/export_script.sh /app/import_script.sh
ENV LD_LIBRARY_PATH=/usr/lib/oracle/${release}.${update}/client64/lib:$LD_LIBRARY_PATH
ENV PATH=/usr/lib/oracle/${release}.${update}/client64/bin:$PATH
CMD [ "/bin/bash", "./export_script.sh" ]
I have tried running the image in a container through the docker desktop app and it has no problem finding the script (although the script does not work since its not connected to aws).
Honestly I have no clue why this is happening and I've tried changing the docker file and the CMD or the command that the job parses to any possible thing, but it still returns the same type of error.
This code:
runs the script from the current directory.
The working directory can be overridden in Docker by using
docker run -w
to start the container. Apparently Batch is doing something to this effect and sets the working directory tomnt/app
Use the absolute path to your script in your dockerfile:
and make sure the script supports it.