Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(docker): set SHELL to an existing binary #6192

Merged
merged 1 commit into from
Mar 2, 2023

Conversation

michaelbeaumont
Copy link
Contributor

@michaelbeaumont michaelbeaumont commented Mar 2, 2023

Without this command, anything that uses the "default shell" of the image, which is ["/bin/sh", "-c"] will fail because this binary doesn't exist in images derived from this Dockerfile.

For example, if another Dockerfile FROMs these images and it uses the "shell form" of commands as described above, the image will be broken:

diff --git i/tools/releases/dockerfiles/Dockerfile.kuma-cp w/tools/releases/dockerfiles/Dockerfile.kuma-cp
index c6f1a6ce6..27893776a 100644
--- i/tools/releases/dockerfiles/Dockerfile.kuma-cp
+++ w/tools/releases/dockerfiles/Dockerfile.kuma-cp
@@ -3,4 +3,4 @@ FROM kumahq/static-debian11:no-push
 ARG ARCH
 COPY /build/artifacts-linux-$ARCH/kuma-cp/kuma-cp /usr/bin

-ENTRYPOINT ["kuma-cp"]
+ENTRYPOINT kuma-cp run

without SHELL:

❯ docker run docker.io/kumahq/kuma-cp:0.0.0-preview.vlocal-build
docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "/bin/sh": stat /bin/sh: no such file or directory: unknown.
ERRO[0000] error waiting for container:

with SHELL:

❯ docker run docker.io/kumahq/kuma-cp:0.0.0-preview.vlocal-build
2023-03-02T14:17:02.463Z	INFO	Skipping reading config from file

Checklist prior to review

  • Link to relevant issue as well as docs and UI issues -- feat: consistent docker images #5343
  • This will not break child repos: it doesn't hardcode values (.e.g "kumahq" as a image registry) and it will work on Windows, system specific functions like syscall.Mkfifo have equivalent implementation on the other OS --
  • Tests (Unit test, E2E tests, manual test on universal and k8s) --
  • Do you need to update UPGRADE.md? --
  • Does it need to be backported according to the backporting policy? --
  • Do you need to explicitly set a > Changelog: entry here or add a ci/ label to run fewer/more tests?

Signed-off-by: Mike Beaumont <mjboamail@gmail.com>
@michaelbeaumont michaelbeaumont requested review from a team, bartsmykla and lukidzi and removed request for a team March 2, 2023 14:19
@michaelbeaumont michaelbeaumont requested a review from lahabana March 2, 2023 14:22
@lahabana
Copy link
Contributor

lahabana commented Mar 2, 2023

Backport to 2.1?

@michaelbeaumont
Copy link
Contributor Author

@Mergifyio backport release-2.1

@mergify
Copy link
Contributor

mergify bot commented Mar 2, 2023

backport release-2.1

✅ Backports have been created

@michaelbeaumont michaelbeaumont merged commit c472950 into kumahq:master Mar 2, 2023
@michaelbeaumont michaelbeaumont deleted the fix/image_shell branch March 2, 2023 15:10
mergify bot pushed a commit that referenced this pull request Mar 2, 2023
Signed-off-by: Mike Beaumont <mjboamail@gmail.com>
(cherry picked from commit c472950)
mergify bot added a commit that referenced this pull request Mar 2, 2023
fix(docker): set `SHELL` to an existing binary (#6192)

Signed-off-by: Mike Beaumont <mjboamail@gmail.com>
(cherry picked from commit c472950)

Co-authored-by: Mike Beaumont <mjboamail@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants