Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

503
Visualizações
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.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

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)"
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda