Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

podman sets (& overrides) the HOSTNAME env variable #8886

Closed
paravoid opened this issue Jan 5, 2021 · 2 comments · Fixed by #8892
Closed

podman sets (& overrides) the HOSTNAME env variable #8886

paravoid opened this issue Jan 5, 2021 · 2 comments · Fixed by #8892
Assignees
Labels
In Progress This issue is actively being worked by the assignee, please do not work on this at this time. kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@paravoid
Copy link

paravoid commented Jan 5, 2021

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind bug

Description

I'm trying to run an image that made the (questionable) choice to bind the network server to the environment's HOSTNAME. Therefore, I'd like to pass HOSTNAME=0.0.0.0 in the container's environment.

However, it seems that podman sets the HOSTNAME environment variable unconditionally to the container (or pod's) hostname. What's worse is that it's being set, even if one passes -e HOSTNAME=something-else.

Steps to reproduce the issue:

  1. podman run -h foo -e HOSTNAME=bar --rm busybox /bin/sh -c 'echo $HOSTNAME'
  2. podman run -e HOSTNAME=bar --rm busybox /bin/sh -c 'echo $HOSTNAME'

Describe the results you received:

  1. foo
  2. ad76a346f1fa

Describe the results you expected:

  1. bar
  2. bar

Additional information you deem important (e.g. issue happens only occasionally):

Output of podman version:

Version:      2.2.1
API Version:  2.1.0
Go Version:   go1.15.6
Built:        Thu Jan  1 02:00:00 1970
OS/Arch:      linux/amd64

Output of podman info --debug:

host:
  arch: amd64
  buildahVersion: 1.18.0
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: 'conmon: /usr/libexec/podman/conmon'
    path: /usr/libexec/podman/conmon
    version: 'conmon version 2.0.20, commit: unknown'
  cpus: 4
  distribution:
    distribution: debian
    version: "10"
  eventLogger: journald
  hostname: donald
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 493216
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 493216
      size: 65536
  kernel: 5.10.0-1-amd64
  linkmode: dynamic
  memFree: 2339422208
  memTotal: 12270800896
  ociRuntime:
    name: crun
    package: 'crun: /usr/bin/crun'
    path: /usr/bin/crun
    version: |-
      crun version 0.15.1
      commit: eb0145e5ad4d8207e84a327248af76663d4e50dd
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +YAJL
  os: linux
  remoteSocket:
    exists: true
    path: /run/user/1000/podman/podman.sock
  rootless: true
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: 'slirp4netns: /usr/bin/slirp4netns'
    version: |-
      slirp4netns version 1.0.1
      commit: 6a7b16babc95b6a3056b33fb45b74a6f62262dd4
      libslirp: 4.4.0
  swapFree: 0
  swapTotal: 0
  uptime: 50h 22m 20.11s (Approximately 2.08 days)
registries:
  search:
  - docker.io
store:
  configFile: /home/user/.config/containers/storage.conf
  containerStore:
    number: 5
    paused: 0
    running: 3
    stopped: 2
  graphDriverName: overlay
  graphOptions:
    overlay.mount_program:
      Executable: /usr/bin/fuse-overlayfs
      Package: 'fuse-overlayfs: /usr/bin/fuse-overlayfs'
      Version: |-
        fusermount3 version: 3.4.1
        fuse-overlayfs: version 1.1.0
        FUSE library version 3.4.1
        using FUSE kernel interface version 7.27
  graphRoot: /home/user/.local/share/containers/storage
  graphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "false"
  imageStore:
    number: 7
  runRoot: /run/user/1000/containers
  volumePath: /home/user/.local/share/containers/storage/volumes
version:
  APIVersion: 2.1.0
  Built: 0
  BuiltTime: Thu Jan  1 02:00:00 1970
  GitCommit: ""
  GoVersion: go1.15.6
  OsArch: linux/amd64
  Version: 2.2.1

Package info (e.g. output of rpm -q podman or apt list podman):

$ dpkg-query -W podman
podman	2.2.1+dfsg1-1

Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide?

Yes

Additional environment details (AWS, VirtualBox, physical, etc.):

Physical.

@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Jan 5, 2021
@mheon
Copy link
Member

mheon commented Jan 5, 2021

I'll take this

@mheon mheon self-assigned this Jan 5, 2021
@mheon mheon added the In Progress This issue is actively being worked by the assignee, please do not work on this at this time. label Jan 5, 2021
@mheon
Copy link
Member

mheon commented Jan 5, 2021

Fix in #8892

mheon added a commit to mheon/libpod that referenced this issue Jan 6, 2021
When adding the HOSTNAME environment variable, only do so if it
is not already present in the spec. If it is already present, it
was likely added by the user, and we should honor their requested
value.

Fixes containers#8886

Signed-off-by: Matthew Heon <[email protected]>
ldidry added a commit to framasoft/docker-collabora-online that referenced this issue Jan 12, 2023
The version of podman in Debian Bullseye is impacted by this bug, which
prevents to set the hostname
See containers/podman#8886
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
In Progress This issue is actively being worked by the assignee, please do not work on this at this time. kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants