moby / moby/buildkit

containerd-worker inside container

Open
#4,787 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/question
Dominant language
Go
Stars
10.3k
Forks
1.5k
Avg merge
1d 23h
Merged PRs (30d)
48

Description

I'm trying to run buildkitd with a containerd worker inside a container, but if fails without a clear error message.
My container:

# syntax = docker/dockerfile:1.7
FROM debian:unstable

RUN apt-get update && apt-get install -y \
    git containerd supervisor \
    && rm -rf /var/lib/apt/lists/*

COPY --link etc /etc
COPY --link --from=moby/buildkit:latest /usr/bin/buildkitd /usr/bin/buildkitd
COPY --link --from=moby/buildkit:latest /usr/bin/buildctl /usr/bin/buildctl

ENTRYPOINT ["/usr/bin/supervisord"]

my /etc/supervisord.conf:

; this is a comment
[supervisord]
nodaemon=true
logfile=/dev/stdout
logfile_maxbytes=0
logfile_backups=0
loglevel=warn
user=root

[program:containerd]
command=containerd

stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

[program:buildkitd]
; this works fine
; command=buildkitd --addr=tcp://0.0.0.0:1234 --addr=unix:///run/buildkit/buildkitd.sock

; this fails
command=buildkitd --debug --oci-worker=false --containerd-worker=true --addr=tcp://0.0.0.0:1234 --addr=unix:///run/buildkit/buildkitd.sock

stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

exec'ing into this container that's running with --privileged and running:

cat <<EOF > Dockerfile
FROM alpine
RUN echo hello
EOF

buildctl build \
  --progress=plain --frontend=dockerfile.v0 --local context=. --local dockerfile=. \
  --output type=image,name=test,push=false

errors with:

....
#4 [1/2] FROM docker.io/library/alpine:latest@sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b
#4 resolve docker.io/library/alpine:latest@sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b 0.0s done
#4 sha256:bca4290a96390d7a6fc6f2f9929370d06f8dfcacba591c76e3d5c5044e7f420c 0B / 3.35MB 0.2s
#4 sha256:bca4290a96390d7a6fc6f2f9929370d06f8dfcacba591c76e3d5c5044e7f420c 3.35MB / 3.35MB 0.3s done
#4 extracting sha256:bca4290a96390d7a6fc6f2f9929370d06f8dfcacba591c76e3d5c5044e7f420c 0.1s done
#4 DONE 0.4s

#5 [2/2] RUN echo hello
#5 ERROR: process "/bin/sh -c echo hello" did not complete successfully: invalid argument
------
 > [2/2] RUN echo hello:
------
Dockerfile:2
--------------------
   1 |     FROM alpine
   2 | >>> RUN echo hello
   3 |     
--------------------
error: failed to solve: process "/bin/sh -c echo hello" did not complete successfully: invalid argument

Should this work? Am I'm doing something wrong?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the setup from the container Dockerfile and /etc/supervisord.conf, using the shown buildctl command and privileged container. Compare the buildkitd and containerd output for the containerd-worker configuration; done means determining whether this setup is supported and providing a clear cause or actionable error for the invalid argument failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker
Domain
build-system, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.