Skip to content

fix: get container ID from /proc/self/mountinfo (for podman)#1092

Merged
buchdag merged 2 commits intonginx-proxy:mainfrom
rioriost:main
May 4, 2024
Merged

fix: get container ID from /proc/self/mountinfo (for podman)#1092
buchdag merged 2 commits intonginx-proxy:mainfrom
rioriost:main

Conversation

@rioriost
Copy link
Copy Markdown
Contributor

With cgroup v2, CID can be read from /proc/self/mountinfo

OCI specification defines that hostname must be set with UTS namespace.
http://wking.github.io/opencontainer-runtime-spec/#_hostname

Podman set the hostname of container running in a pod to a name of pod, e.g. 'test-pod', not a container ID, e.g. '1cb364360e42'.
Docker API via /tmp/docker.sock linked to /var/run/podman.sock returns error as following.
{"cause":"no such container","message":""test-pod" is a pod, not a container: no such container","response":404}

Need to get container ID from /proc/self/mountinfo from the container inside if the container is running in a pod by Podman.

With cgroup v2, CID can be read from /proc/self/mountinfo
buchdag
buchdag previously approved these changes Jan 30, 2024
@buchdag buchdag added the type/fix PR for a bug fix label Jan 30, 2024
@buchdag buchdag changed the title Update functions.sh fix: get container ID from /proc/self/mountinfo (for podman) Jan 30, 2024
@buchdag
Copy link
Copy Markdown
Member

buchdag commented Jan 30, 2024

Hi.

Does neither the /proc/1/cpuset nor /proc/self/cgroup methods work on Podman ?

@buchdag
Copy link
Copy Markdown
Member

buchdag commented Feb 10, 2024

friendly ping @rioriost

buchdag
buchdag previously approved these changes May 4, 2024
@buchdag buchdag merged commit c99e656 into nginx-proxy:main May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type/fix PR for a bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants