From: Thomas Petazzoni via buildroot <buildroot@buildroot.org>
To: "Yann E. MORIN" <yann.morin.1998@free.fr>,
Christian Stewart <christian@paral.in>,
Buildroot List <buildroot@buildroot.org>
Cc: Ricardo Martincoski <ricardo.martincoski@datacom.com.br>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: [Buildroot] [PATCH RFC 1/2] utils/docker-run: make it compatible with SELinux
Date: Wed, 26 Jul 2023 23:20:07 +0200 [thread overview]
Message-ID: <20230726212009.221147-1-thomas.petazzoni@bootlin.com> (raw)
After switching to a fresh Fedora 38 installation with SELinux
disabled, we noticed that utils/docker-run doesn't work as the
applications running inside the container are not allowed to accept
the data mounted through the bind mount.
Turns out that Docker has a "Z" option to do the appropriate magic for
SELinux. However, this "Z" option is only available for --volume, not
for --mount, as explained in
https://docs.docker.com/storage/bind-mounts/.
So, this commit partially reverts 7f2020f9040f ("utils/docker-run:
improve user experience") that switched from --volume to
--mount. However, the justification in 7f2020f9040f to switch from
--volume to --mount was "Docker will create the destination if it does
not exist", but the current Docker documentation seems to say exactly
the opposite:
If you use -v or --volume to bind-mount a file or directory that
does not yet exist on the Docker host, -v creates the endpoint for
you. It is always created as a directory.
If you use --mount to bind-mount a file or directory that does not
yet exist on the Docker host, Docker does not automatically create
it for you, but generates an error.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
NOTE: I am not a Docker expert, and I certainly don't know if this is
the right solution, and I would appreciate feedback from folks with
more Docker experience.
---
utils/docker-run | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/utils/docker-run b/utils/docker-run
index 17c587a484..eee1aad7a4 100755
--- a/utils/docker-run
+++ b/utils/docker-run
@@ -12,8 +12,8 @@ declare -a docker_opts=(
-i
--rm
--user "$(id -u):$(id -g)"
- --mount "type=bind,src=${MAIN_DIR},dst=${MAIN_DIR}"
- --mount "type=bind,src=${GIT_DIR},dst=${GIT_DIR}"
+ --volume "${MAIN_DIR}:${MAIN_DIR}:Z"
+ --volume "${GIT_DIR}:${GIT_DIR}:Z"
--workdir "${MAIN_DIR}"
)
if tty -s; then
--
2.41.0
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next reply other threads:[~2023-07-26 21:20 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-26 21:20 Thomas Petazzoni via buildroot [this message]
2023-07-26 21:20 ` [Buildroot] [PATCH RFC 2/2] utils/docker-run: mount the download directory if specified Thomas Petazzoni via buildroot
2023-08-08 20:50 ` Yann E. MORIN
2023-08-08 21:24 ` Thomas Petazzoni via buildroot
2023-07-27 8:13 ` [Buildroot] [PATCH RFC 1/2] utils/docker-run: make it compatible with SELinux Antoine Tenart
2023-07-27 8:48 ` Thomas Petazzoni via buildroot
2023-07-27 10:19 ` Antoine Tenart
2023-07-27 10:24 ` Thomas Petazzoni via buildroot
2023-07-27 10:50 ` Antoine Tenart
2023-07-27 11:47 ` Antoine Tenart
2023-07-27 16:21 ` Yann E. MORIN
[not found] ` <CA+h8R2qJF87Wi_w9DBjFZO__x=Kku+hfU1_-uhn2tLegFtc37g@mail.gmail.com>
2023-07-28 7:24 ` Thomas Petazzoni via buildroot
2023-08-09 21:32 ` Yann E. MORIN
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=20230726212009.221147-1-thomas.petazzoni@bootlin.com \
--to=buildroot@buildroot.org \
--cc=christian@paral.in \
--cc=ricardo.martincoski@datacom.com.br \
--cc=thomas.petazzoni@bootlin.com \
--cc=yann.morin.1998@free.fr \
/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