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

495
Vistas
docker-compose exec failed: executable file not found in $PATH

I want to get an interactive prompt with docker-compose exec [service_name] [shell] and to fallback on another shell if the first does not exist.

I tried to run the following command:

docker-compose exec [service_name] "(which zsh && zsh) || (which bash && bash) || (which sh && sh)"

but I got this error:

rpc error: code = 2 desc = oci runtime error: exec failed: container_linux.go:247: starting container process caused "exec: \"\\\"(which zsh && zsh) || (which bash && bash) || (which sh && sh)\\\"\": executable file not found in $PATH"

If I run

docker-compose exec [service_name] bash (zsh/bash/sh)

it opens a bash prompt and then inside the container I run

(which zsh && zsh) || (which bash && bash) || (which sh && sh)

and it works fine, it changes the shell to zsh.

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

0

It's not clear what the command inside the container actually is. If there is an entrypoint like /bin/sh, then your command will need to be -c "command". Since I don't have your docker-compose setup, here's a docker setup that may be similar:

docker run -ti --entrypoint /bin/sh --rm alpine -c \
  "(which zsh && zsh) || (which bash && bash) || (which sh && sh)"
about 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