zero-to-jupyterhub-k8s icon indicating copy to clipboard operation
zero-to-jupyterhub-k8s copied to clipboard

/bin/sh default when using extraContainers:

Open BuckinghamIO opened this issue 1 year ago • 3 comments
trafficstars

Bug description

When adding an extra containers for the single user environment the image-puller has a hardcoded command that it trys to execute to feedback if the process has been completed.

command:
  - /bin/sh
  - -c
  - echo "Pulling complete"

A issue arrises where when a extra container may not have bash and this causes an error preventing the startup of a container.

How to reproduce

Add any container that does not have /bin/bash to the singleUser environment, in my experience I was trying to add cloud-sql-proxy.

Expected behaviour

The image should run as expected and not be prevented by a JupyterHub requirement that all extra containers should have bash installed.

Actual behaviour

Error within the image-puller daemon set.

Error: failed to create containerd task: failed to create shim task: OCI runtime create failed: runc create failed: unab │ │ le to start container process: exec: "/bin/sh": stat /bin/sh: no such file or directory: unknown

BuckinghamIO avatar Jul 26 '24 11:07 BuckinghamIO

Running a minimal command means we can pre-pull an image by running it as a daemonset.

Do you have a suggestion for a better way to pre-pull images? Would you be happy if the command was configurable for each pulled image?

manics avatar Jul 26 '24 11:07 manics

Well the issue with this command or even I guess the requirement for a command is some images are distroless which this clearly wont work with.

A configurable command may allow more options for sure, although Im not sure in my case it would be a solution either.

BuckinghamIO avatar Jul 26 '24 12:07 BuckinghamIO

I had a similar issue: the distroless image has busybox but has nothing in /bin/sh Worked this around by creating a custom image with the following Dockerfile:

FROM myrepo/image-distroless:latest
RUN /busybox/busybox ln -sf /busybox/busybox /bin/sh

I don't like this solution as it requires an additional custom image (and probably private registry infrastructure) but it works.

k-popov avatar Dec 03 '24 20:12 k-popov