containers / buildah

A tool that facilitates building OCI images.
https://buildah.io
Apache License 2.0
7.15k stars 767 forks source link

Main difference between "array" and "string" forms of `buildah config --entrypoint` command not described in the man page `buildah-config` #5598

Open makhomed opened 2 weeks ago

makhomed commented 2 weeks ago

Description Command buildah config --entrypoint not work as expected and as it documented.

podman hung when try to stop such container, because it can't detect what entrypoint is systemd. because container entrypoint is really /bin/sh, not /usr/lib/systemd/systemd.

Steps to reproduce the issue:

  1. buildah from scratch
  2. buildah config --entrypoint "/usr/lib/systemd/systemd" working-container
  3. buildah inspect working-container | less

Describe the results you received:

        "config": {
            "Entrypoint": [
                "/bin/sh",
                "-c",
                "/usr/lib/systemd/systemd"
            ],

Describe the results you expected:

        "config": {
            "Entrypoint": [
                "/usr/lib/systemd/systemd"
            ],

Output of rpm -q buildah or apt list buildah:

buildah-1.33.7-2.el9_4.x86_64

Output of buildah version:

Version:         1.33.7
Go Version:      go1.21.10 (Red Hat 1.21.10-1.el9_4)
Image Spec:      1.1.0-rc.5
Runtime Spec:    1.1.0
CNI Spec:        1.0.0
libcni Version:  v1.1.2
image Version:   5.29.2
Git Commit:
Built:           Wed Jun 12 04:48:06 2024
OS/Arch:         linux/amd64
BuildPlatform:   linux/amd64

*Output of `cat /etc/release`:**

VERSION_ID="9.4"
PLATFORM_ID="platform:el9"

Output of uname -a:

Linux example.com 5.14.0-427.20.1.el9_4.x86_64
#1 SMP PREEMPT_DYNAMIC Fri Jun 7 14:51:39 UTC 2024
x86_64 x86_64 x86_64 GNU/Linux

Output of cat /etc/containers/storage.conf:

# cat /etc/containers/storage.conf | grep -P '^[^#]'
[storage]
driver = "overlay"
runroot = "/run/containers/storage"
graphroot = "/var/lib/containers/storage"
[storage.options]
additionalimagestores = [
]
pull_options = {enable_partial_images = "false", use_hard_links = "false", ostree_repos=""}
[storage.options.overlay]
mountopt = "nodev,metacopy=on"
[storage.options.thinpool]
makhomed commented 2 weeks ago

workaround exists:

buildah config --entrypoint '[ "/usr/lib/systemd/systemd" ]' $container

in this case all works as expected:

# buildah inspect working-container | less

        "config": {
            "Entrypoint": [
                "/usr/lib/systemd/systemd"
            ]
        },

probably this is not a bug in buildah binary, but this is the bug in the man buildah-config, because in the manual not described this difference - "when the entrypoint is specified as a string" - then '["/bin/sh", "-c"]' added as silently forced prefix to entrypoint. But "if you use the array form" - in this case '["/bin/sh", "-c"]' not added as prefix. This main difference between two forms of entrypoint not described in the buildah configuration.

rhatdan commented 2 weeks ago

Interested in opening a PR to fix documentation?

makhomed commented 1 week ago

Interested in opening a PR to fix documentation?

Sorry, but not.

Because English is not my native language, and I am not sure in the high quality of such my PR.