From: Guillaume Tucker <gtucker@gtucker.io>
To: Nathan Chancellor <nathan@kernel.org>, Miguel Ojeda <ojeda@kernel.org>
Cc: linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org,
linux-kbuild@vger.kernel.org,
automated-testing@lists.yoctoproject.org,
workflows@vger.kernel.org, llvm@lists.linux.dev,
"Arnd Bergmann" <arnd@arndb.de>,
"Onur Özkan" <work@onurozkan.dev>
Subject: Re: [PATCH v1 1/2] scripts: add tool to run containerized builds
Date: Sat, 13 Dec 2025 05:16:21 +0100 [thread overview]
Message-ID: <b476af54-59dd-4b33-aa5c-4aded5d88e19@gtucker.io> (raw)
In-Reply-To: <97dec58ebe4161027f13f2215ed9da4a43bc8c47.1765374789.git.gtucker@gtucker.io>
[+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
next prev parent reply other threads:[~2025-12-13 15:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-10 13:58 [PATCH v1 0/2] scripts: introduce " Guillaume Tucker
2025-12-10 13:58 ` [PATCH v1 1/2] scripts: add tool to run " Guillaume Tucker
2025-12-13 4:16 ` Guillaume Tucker [this message]
2025-12-15 9:24 ` Onur Özkan
2025-12-15 10:15 ` Guillaume Tucker
2025-12-10 13:58 ` [PATCH v1 2/2] Documentation: dev-tools: add container.rst page Guillaume Tucker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b476af54-59dd-4b33-aa5c-4aded5d88e19@gtucker.io \
--to=gtucker@gtucker.io \
--cc=arnd@arndb.de \
--cc=automated-testing@lists.yoctoproject.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=nathan@kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=work@onurozkan.dev \
--cc=workflows@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox