skip to Main Content

I am trying to run the project given here. It is an algorithm for compiling LaTeX from a docker container. But I am struggling to execute the last command of the given steps. Follows a list of the commands I am typing.

sudo groupadd docker
sudo usermod -aG docker ${USER}
su ${USER}
IMAGE=blang/latex:ctanfull
docker pull ${IMAGE}
docker run "$IMAGE" run.sh

However, the last command returns the following error:

docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "run.sh": executable file not found in $PATH: unknown.
ERRO[0000] error waiting for container:

It seems the docker container is not able to find files in my local directory.
Precisely, I have to call a docker container, and from this container execute a local bash script, without changing the docker image.
I also tried other commands, listed below.

docker run --rm --entrypoint '' blang/latex:ctanfull sh -c "./run.sh"
docker run -it --rm --entrypoint '' blang/latex:ctanfull /bin/bash -c "./run.sh"
docker run -it --rm --entrypoint '' blang/latex:ctanfull sh -c "./run.sh"

But none of them is capable of finding the run.sh script.

Thanks for attention, and best regards.

2

Answers


  1. Docker containers don’t have access to the host file system unless you explicitly grant it to them

    To give your container access to the run.sh script you can either map the script into the container using a volume mapping, like this

    docker run -v $(pwd)/run.sh:/script/run.sh "$IMAGE" /script/run.sh
    

    Now the run.sh script is accessible inside the container as /script/run.sh.

    Or, if you prefer, you can pipe the script into a shell in the container, like this

    cat run.sh | docker run -i "$IMAGE" /bin/sh
    
    Login or Signup to reply.
  2. If the run.sh is in your local machine you can run like this in the same folder

     docker run -v `pwd`:/tmp -it blang/latex:ctanfull sh /tmp/run.sh
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search