Everytime I try and exec into a pod through the minikube dashboard running alpine linux it crashes and closes the connection with the following error
rpc error: code = 2 desc = oci runtime error: exec failed: container_linux.go:262: starting container process caused "exec: \"bash\": executable file not found in $PATH"
CONNECTION CLOSED
Output from the command "kubectl version" reads as follows:
Client Version: version.Info{Major:"1", Minor:"8",
GitVersion:"v1.8.0", GitCommit:"6e937839ac04a38cac63e6a7a306c5d035fe7b0a", GitTreeState:"clean", BuildDate:"2017-09-28T22:57:57Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"8",
GitVersion:"v1.8.0",
GitCommit:"0b9efaeb34a2fc51ff8e4d34ad9bc6375459c4a4",
GitTreeState:"clean", BuildDate:"2017-11-29T22:43:34Z", GoVersion:"go1.9.1", Compiler:"gc", Platform:"linux/amd64"}
Can anybody please advise? I can run other containers perfectly OK as long as they have BASH not ASH.
Many thanks
Normally Alpine linux doesn't contain bash. Have you tried executing into the container with any of the following?
/bin/ash
/bin/sh
ash
sh
so for example kubectl exec -it my-alpine-shell-293fj2fk-fifni2 -- sh
should do the job.
Everytime I try and exec into a pod
You didn't specify the command you provided to kubectl exec
but based on your question I'm going to assume it is kubectl exec -it $pod -- bash
The problem, as the error message states, is that the container image you are using does not provide bash. Many, many "slim" images don't ship with bash
because of the dependencies doing so would bring with them.
If you want a command that works across all images, use sh
, since 90% of the time if bash
is present, it is symlinked to /bin/sh
and the other cases (as you mentioned with ash
or dash
or whatever) then using sh
will still work and allow you to determine if you need to adjust the command to specifically request a different shell.
Thus kubectl exec -it $pod -- sh
is the command I would expect to work