How to access the Docker container receiving error message while running exec command

Asked

Viewed 55 times

0

I am trying to access the containers and am getting the following error message:

OCI Runtime exec failed: exec failed: container_linux.go:345: Starting container process caused "exec: "bash ": Executable file not found in $PATH": Unknown

How can I proceed to resolve this access gap?

  • Your question has neither foot nor head.

  • Hello Richard. What command are you using exactly to receive this error? If possible, also give details of which Docker image you are using in your container.

1 answer

1


The error is clear: The file bash could not be found.

Possible problems are:

  1. To variable $PATH is not properly defined to find the binary.
  2. The image used in your container doesn’t really have the bash available.

To solve the first case, try calling by the full path (the path may vary depending on the base image). An example:

docker exec -it meu-container /bin/bash

The bash not being available is quite common in images that use Alpine Linux as a base image, as these do not have the bash installed by default. An alternative in this case is to use sh or install the bash in your container.

To use the sh execute:

docker exec -it meu-container sh

If you prefer the bash, add the installation to your Dockerfile and generate a new image.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.