[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b476af54-59dd-4b33-aa5c-4aded5d88e19@gtucker.io>
Date: Sat, 13 Dec 2025 05:16:21 +0100
From: Guillaume Tucker <gtucker@...cker.io>
To: Nathan Chancellor <nathan@...nel.org>, Miguel Ojeda <ojeda@...nel.org>
Cc: linux-kernel@...r.kernel.org, rust-for-linux@...r.kernel.org,
linux-kbuild@...r.kernel.org, automated-testing@...ts.yoctoproject.org,
workflows@...r.kernel.org, llvm@...ts.linux.dev,
Arnd Bergmann <arnd@...db.de>, Onur Özkan
<work@...rozkan.dev>
Subject: Re: [PATCH v1 1/2] scripts: add tool to run containerized builds
[+Onur - sorry I didn't Cc you when sending this series]
On 10/12/2025 2:58 pm, Guillaume Tucker wrote:
> +def run_docker(args):
> + """Run a command in a Docker container"""
> + uid = args.uid or os.getuid()
> + gid = args.gid or args.uid or os.getgid()
> + cmd = [
> + 'docker', 'run',
> + '--interactive',
> + '--volume', f'{os.getcwd()}:/src',
> + '--workdir', '/src',
> + '--user', f'{uid}:{gid}'
> + ]
> + if args.env_file:
> + cmd += ['--env-file', args.env_file]
> + cmd.append(args.image)
> + cmd += args.cmd
> + return subprocess.call(cmd)
Just realised that it also needs a TTY to handle Ctrl-C signals
correctly, otherwise the Python process would stop but the container
would keep running in a detached process (same for podman):
diff --git a/scripts/container b/scripts/container
index 74644ac33685..e05425c06d28 100755
--- a/scripts/container
+++ b/scripts/container
@@ -30,6 +30,7 @@ def run_docker(args):
cmd = [
'docker', 'run',
'--interactive',
+ '--tty',
'--volume', f'{os.getcwd()}:/src',
'--workdir', '/src',
'--user', f'{uid}:{gid}'
I'll send a v2 next week, but I'll wait a bit for any feedback first.
Thanks,
Guillaume
Powered by blists - more mailing lists