Maduraiveeran
Maduraiveeran

Reputation: 301

Buildah fails to download artifact when run inside a kubernetes container but fine when directly run from my machine

I have a Dockerfile which includes (for example):

RUN wget https://updates.jenkins.io/download/plugins/SBuild/1.0.2/SBuild.hpi

and I try to build it directly from my machine:

buildah bud -t myimage .

works.

When I try to build this from inside a container (call it containerX) running inside Kubernetes, the command stays there forever/fails. However, the wget works when run directly from the containerX.

I can work it around by downloading the artifacts from containerX and copy it into the target container/image. However, it will take off the flexibitlity as it involves more files and also I am trying to understand what is going on here.

To summarise buildah:

  1. Run from my laptop - Pass
  2. Run from inside containerX (under k8s) - Fail
  3. wget run directly in containerX - Pass
  4. wget run inside the buildah container (kubernetes->continerX->buildahContainer) - Fail (following is the terminal output)

enter image description here

containerX -> Ubuntu 24.04 LTS

buildahContainer -> Debian GNU/Linux 12 (bookworm)

kubernetes -> MicroK8s v1.28.9 revision 6750

Please let me know if you need more information in this regard.

Thanks for your time.

UPDATE: Playing further with it, I observed the following:

  1. I was able to wget https://baltocdn.com/helm/signing.asc (it is only the jenkins/github related ones that fail)
  2. I could see that a podman network in the route through which the inner container communicates (see image) enter image description here
  3. If I run buildah with option --network host (which is undesirable) all works

Upvotes: 0

Views: 80

Answers (0)

Related Questions