Existing binary executable not found inside kubernetes mounted volume in Docker image

4/4/2019

I have mounted a binary (tini init) to the /executables mountPath. The docker image is busybox:latest

Mounting:

- name: executables
  mountPath: /executables

Volume creation:

- name: executables
  emptyDir: {}

I ran a sidecar container that adds the tini binary to this volume.

inside the /executables directory after attaching to the container:

/executables # ls
tini
/executables # pwd
/executables
/executables # ls
tini
/executables # ./tini 
sh: ./tini: not found
/executables # 

Everything's alright but when I try executing it, it shows not found when the file is right there! driving me nuts. Please help!

-- Hrishikesh
docker
google-kubernetes-engine
kubernetes

2 Answers

4/5/2019

If you just download the binary you have change the permission and do a chmod +x tini before try to launch it.

-- Darkjeff
Source: StackOverflow

4/5/2019

Solved this using a static build for the binary, turns out it's very relevant to this: https://unix.stackexchange.com/questions/18061/why-does-sh-say-not-found-when-its-definitely-there

-- Hrishikesh
Source: StackOverflow