Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

419
Vistas
Docker: Unable to run shell script stored in a mounted volume

I am running Docker (1.10.2) on Windows. I created a script to echo 'Hello World' on my machine and stored it in C:/Users/username/MountTest. I created a new container and mounted this directory (MountTest) as a data volume. The command I ran to do so is shown below:

docker run -t -i --name mounttest -v /c/Users/sarin/MountTest:/home ubuntu /bin/bash

Next, I run the command to execute the script within the container mounttest.

docker exec -it mounttest sh /home/helloworld.sh

The result is as follows:

: not foundworld.sh: 2: /home/helloworld.sh:
Hello World

I get the desired output (echo Hello World) but I want to understand the reason behind the not found errors.

Note: This question might look similar to Run shell script on docker from shared volume, but it addresses permission related issues.

References: The helloworld.sh file:

#!/bin/sh

echo 'Hello World'

The mounted volumes information is captured below. enter image description here

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Considering the default ENTRYPOINT for the 'ubuntu' image is sh -c, the final command executed on docker exec is:

sh -c 'sh /home/helloworld.sh'

It looks a bit strange and might be the cause of the error message.

Try simply:

docker exec -it mounttest /home/helloworld.sh
# or
docker exec -it mounttest sh -c '/home/helloworld.sh'

Of course, the docker exec should be done in a boot2docker ssh session, simalar to the shell session in which you did a docker run.
Since the docker run opens a bash, you should make a new boot2docker session (docker-machine ssh), and in that new boot2docker shell session, try the docker exec.

Trying docker exec from within the bash made by docker run means trying to do DiD (Docker in Docker). It is not relevant for your test.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda