sysbox icon indicating copy to clipboard operation
sysbox copied to clipboard

Doesn't run Docker inside when top level build invoked using BuildKit

Open XVilka opened this issue 3 years ago • 3 comments

Same image, with and without export DOCKER_BUILDKIT=1 produces different results. Legacy builder runs Docker inside just fine with Sysbox, while BuildKit builds fail to connect to the Docker:

Ubuntu 20.04.05 LTS with 5.4.0-122-generic kernel

Screen Shot 2022-10-28 at 14 53 45 Screen Shot 2022-10-28 at 14 56 42

XVilka avatar Oct 28 '22 06:10 XVilka

@XVilka, looks like docker is simply unable to initialize in the failing scenario.

But let's step back one sec as I'm not sure i'm fully understanding your setup. Can you please describe how you reproduce this issue? Which instruction are you executing to launch the sysbox container in the working and non-working scenario? Also, how are you building your image within the sysbox container when relying on dockerd and builtkit?

rodnymolina avatar Oct 28 '22 07:10 rodnymolina

@rodnymolina, I have a Dockerfile that somewhere inside calls docker run .... Currently, sysbox is the default runtime on my server, so I don't need to supply any additional parameters. I build the same image using either default docker build or export DOCKER_BUILDKIT=1 && docker build. In the first case docker inside docker runs just fine (during the build stage), while in the second I observe the error.

Host OS is Ubuntu 20.04.05 LTS x86_64 with 5.4.0-122-generic kernel

FROM ubuntu:20.04

# Non-interactive installation requirements
ARG DEBIAN_FRONTEND=noninteractive

# Set installation options
RUN echo 'debconf debconf/frontend select Noninteractive' > /debconf-seed.txt && \
    echo 'tzdata tzdata/Areas select Etc' >> /debconf-seed.txt && \
    echo 'tzdata tzdata/Zones/Etc select UTC' >> /debconf-seed.txt && \
    echo 'locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8' >> /debconf-seed.txt && \
    echo 'locales locales/default_environment_locale select en_US.UTF-8' >> /debconf-seed.txt && \
    debconf-set-selections /debconf-seed.txt

RUN apt-get update -qq && apt-get install -y docker.io

COPY inside.sh /inside.sh
RUN /inside.sh

where inside.sh is this script:

#!/bin/sh

# Start Docker daemon (only works with Sysbox runtime)
nohup dockerd 2>&1 | tee "dockerd.log" &
sleep 15
cat "dockerd.log"
docker info

docker run alpine:3.16 cat /etc/os-release

Then I run it with a following ./run simple script:

#!/bin/sh
echo "Building container..."
docker build --tag sysbox-test . || exit 1

If I do ./run - it prints the Alpine /etc/os-release contents - if I do DOCKER_BUILDKIT=1 ./run - it has this error.

XVilka avatar Oct 28 '22 09:10 XVilka

@rodnymolina was my information sufficient on reproducing the issue?

XVilka avatar Jul 17 '23 04:07 XVilka