Running what I think to be a pretty basic example: clone my repo, build a dockerfile (under alt filename than default), and add a label to the image just for show.
import sys
import anyio
import dagger
from dagger import Client, Container
async def main():
my_repo = "https://github.com/OverkillGuy/mass-driver"
async with dagger.Connection(dagger.Config(log_output=sys.stderr)) as client:
context_dir = client.host().directory(".")
dockerfile_name = "release.Dockerfile" # Not just the standard Dockerfile
md_code = client.git(url=my_repo).branch("main").tree()
app_folder = "app"
# Put the cloned repo in /app of current folder
workspace = context_dir.with_directory(app_folder, md_code)
container = (
await client.container()
# build in /app
.build(context=workspace, dockerfile=f"{app_folder}/{dockerfile_name}")
.with_label("author", "Me!")
)
return container
anyio.run(main)
Error I get is this, during build of the dockerfile (there's more but this is the core bit)
23: [0.23s] runc run failed: unable to start container process: error during container init: error mounting "cgroup" to rootfs at "/sys/fs/cgroup": mount cgroup:/sys/fs/cgroup/openrc (via /proc/self/fd/6), flags: 0xf, data: openrc: invalid argument
23: [builder 2/5] RUN pip install --no-cache-dir poetry==1.6.1 ERROR: process "/bin/sh -c pip install --no-cache-dir poetry==${POETRY_VERSION}" did not complete successfully: exit code: 1
Looking around seems to be a classic "you're doing docker-in-docker but your cgroups aren't configured for nesting, per https://github.com/containerd/containerd/issues/6659.
I'm surprised that docker in docker would be what Dagger engine goes for, something I've usually heard is an antipattern.
Am I missing something, or should I just allow nesting of cgroups?
Anything to say about my sample code, separately?