2

I'm trying to create an Ubuntu-based image for k3d and running into some problems. Please help

Dockerfile

ARG K3S_VERSION=v1.22.6-k3s1
FROM rancher/k3s:${K3S_VERSION} AS k3s

FROM ubuntu:20.04
COPY --from=k3s / /
RUN mkdir -p /etc \
  && echo 'hosts: files dns' > /etc/nsswitch.conf \
  && chmod 1777 /tmp \
  && mkdir -p /var/lib/rancher/k3s/agent/etc/containerd/
VOLUME /var/lib/kubelet
VOLUME /var/lib/rancher/k3s
VOLUME /var/lib/cni
VOLUME /var/log
ENV PATH="$PATH:/bin/aux"
ENTRYPOINT ["/bin/k3s"]
CMD ["agent"]

I'm building this with docker build -t k3s . and then running via k3d cluster create -i k3s --verbose -a 0 --no-rollback. This returns the error (the rest of the logs don't reveal much):

ERRO[0013] Failed Cluster Start: error during post-start cluster preparation: error overwriting contents of /etc/hosts: Exec process in node 'k3d-k3s-default-server-0' failed with exit code '126' 

The full container logs are available here. Here's a couple of (potentially) relevant highlights:

time="2022-02-28T20:26:40Z" level=info msg="Waiting to retrieve kube-proxy configuration; server is not ready: https://127.0.0.1:6443/v1-k3s/readyz: 500 Internal Server Error"
Mounting command: mount
Mounting arguments: -t tmpfs -o size=178257920 tmpfs /var/lib/kubelet/pods/37750274-69e3-4695-af0c-b93e749f7c92/volumes/kubernetes.io~projected/kube-api-access-6lzp4
Output:
E0228 20:26:56.919989       8 mount_linux.go:194] Mount failed: fork/exec /usr/bin/mount: no such file or directory

This makes me wonder that /usr/bin/mount is not there, which I'm assuming is due to COPY --from=k3s / / overwriting things`, which is recommended on the CUDA workflow.

So, where do I go from here?

MrSimonEmms
  • 1,321
  • 2
  • 16
  • 32

0 Answers0