Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

1.2K
Views
El comando '/bin/sh devolvió un código distinto de cero: 1

Cuando intento instalar un archivo bin manualmente dentro de un contenedor Docker de ubuntu, funciona perfectamente.

 ./MyBinfile.bin

pero cuando lo intento desde mi Dockerfile, siempre aparece el error: El comando '/bin/sh -c chmod +x /tmp/snapcenter_linux_host_plugin.bin && ./tmp/MyBinFile.bin' devolvió un código distinto de cero: 1

Mi Dockerfile se parece a:

 FROM debian:jessie RUN apt-get update && apt-get install -y openjdk-7-jdk ENV JAVA_HOME /usr/lib/jvm/java-7-openjdk-amd64 RUN echo $JAVA_HOME COPY MyBinFile.bin /tmp/MyBinFile.bin RUN chmod +x /tmp/MyBinFile.bin && ./tmp/MyBinFile.bin

¿Alguien puede ayudarme en este caso?

about 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Copió MyBinFile.bin a /tmp/MyBinFile.bin. Esos no son el mismo archivo. Si necesita ejecutarlo, use la ruta absoluta para el archivo que tiene un atributo ejecutable. Así que tu última línea debería ser:

 RUN chmod +x /tmp/MyBinFile.bin && /tmp/MyBinFile.bin

'.' (punto) representa su directorio de trabajo actual actual. Se recomienda usar siempre rutas absolutas si no está seguro de cuál es su cwd.

EDITAR

Ejecutar su Dockerfile produce el siguiente resultado:

 Sending build context to Docker daemon 3.584 kB Step 1/6 : FROM debian:jessie ---> 8cedef9d7368 Step 2/6 : RUN apt-get update && apt-get install -y openjdk-7-jdk ---> Using cache ---> 1a0005923f41 Step 3/6 : ENV JAVA_HOME /usr/lib/jvm/java-7-openjdk-amd64 ---> Using cache ---> 5651d50b519e Step 4/6 : RUN echo $JAVA_HOME ---> Using cache ---> 96655235a2cf Step 5/6 : COPY MyBinFile.bin /tmp/MyBinFile.bin ---> 60c79aaf5aca Removing intermediate container cd729c315e9b Step 6/6 : RUN chmod +x /tmp/MyBinFile.bin && /tmp/MyBinFile.bin ---> Running in 5db126cbd24c /bin/sh: 1: /tmp/MyBinFile.bin: Text file busy The command '/bin/sh -c chmod +x /tmp/MyBinFile.bin && /tmp/MyBinFile.bin' returned a non-zero code: 2

Pero si separo tu último paso en dos pasos diferentes:

 FROM debian:jessie RUN apt-get update && apt-get install -y openjdk-7-jdk ENV JAVA_HOME /usr/lib/jvm/java-7-openjdk-amd64 RUN echo $JAVA_HOME COPY MyBinFile.bin /tmp/MyBinFile.bin RUN chmod +x /tmp/MyBinFile.bin RUN /tmp/MyBinFile.bin

entonces se ejecuta OK.

about 4 years ago · Santiago Trujillo Report

0

Tuve un problema similar al ejecutar NextJs dentro de Docker. Así es como resolví el problema:

Nota: esta solución también resolverá el EACCES error...Permission denied al acceder a archivos dentro de la aplicación dockerizada, por ejemplo, páginas de ruta.

Agregué el usuario root inmediatamente antes del comando para cambiar la propiedad y luego volví a ejecutar el resto de los comandos junto con el contenedor con el usuario non-root , es decir, el usuario del node de la imagen alpina base.

 # The "./" is the working directory eg /usr/app USER root RUN chmod a+w ./ -R # Later switch back to run rest of commands and container as node non-root user USER node
about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!