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

689
Vistas
Docker: Cannot execute binary file

I can't run any binary in my docker container.

Dockerfile:

FROM ubuntu:eoan AS compiler-build

RUN apt-get update && \
    dpkg --add-architecture i386 && \
    apt-get install -y gcc \
                       gcc-multilib \
                       make \
                       cmake \
                       git \
                       python3.8 \
                       bash

WORKDIR /home
ADD . /home/pawn
RUN mkdir build
WORKDIR /home/build
ENTRYPOINT ["/bin/bash"]
CMD ["/bin/bash"]

I can't even use file builtin:

[root@LAPTOP-EJ5BH6DJ compiler]:~/dev/private/SAMP/compiler (v13.11.0) (master) dc run compiler file bash
/usr/bin/file: /usr/bin/file: cannot execute binary file
over 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

Entrypoint can't point to /bin/bash it seems. Removing ENTRYPOINT ["/bin/bash"] is enough to make it work.

over 4 years ago · Santiago Trujillo Denunciar

0

From this forum thread:

This error occurs when you use a shell in your entrypoint without the "-c" argument

So, if you change your Dockerfile to end with

ENTRYPOINT [ "/bin/bash", "-l", "-c" ]

then you can run binary files.

Note the purpose of the options for /bin/bash, from the manpage:

  • -l: Make bash act as if it had been invoked as a login shell

  • -c: If the -c option is present, then commands are read from the first non-option argument command_string. If there are arguments after the command_string, the first argument is assigned to $0 and any remaining arguments are assigned to the positional parameters. The assignment to $0 sets the name of the shell, which is used in warning and error messages.

Additionally, this article is a worthwhile read on how to use both ENTRYPOINT and CMD together, and what their differences are.

EDIT: Here's another article that goes into a trivial (but clearer than the first article) example using the echo shell builtin.

EDIT: Here's an adaptation of the trivial example from the second article I linked:

FROM ubuntu
ENTRYPOINT [ "/bin/bash", "-l", "-c" ]
CMD [ "ls" ]
$ docker build -t test .

$ docker run --rm test
bin
boot
...
var

$ docker run --rm test "ls etc"
adduser.conf
alternatives
apt
...
update-motd.d
xattr.conf

Note the " around ls /etc. Without the quotes, the argument /etc doesn't seem to be passed to the ls command as I might expect.

over 4 years ago · Santiago Trujillo Denunciar

0

I hit the same error. Unlike the other answers, my error was related to my docker run parameters:

# failed
docker run -it $(pwd | xargs basename):latest bash

# worked
docker run -it $(pwd | xargs basename):latest

I didn't need to add bash as I already had this in my Dockerfile:

ENTRYPOINT ["/bin/bash"]
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