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

hostname is not added to /etc/hosts #1745

Closed
jfilak opened this issue Nov 1, 2018 · 6 comments · Fixed by #1751
Closed

hostname is not added to /etc/hosts #1745

jfilak opened this issue Nov 1, 2018 · 6 comments · Fixed by #1751
Assignees
Labels
locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@jfilak
Copy link

jfilak commented Nov 1, 2018

Is this a BUG REPORT or FEATURE REQUEST?:

kind bug

Description

podman does not add container's hostname to /etc/hosts (docker does).

Steps to reproduce the issue:

  1. podman run -it --rm --hostname foobar centos /bin/bash
  2. cat /etc/hosts

Describe the results you received:
I can see the content of host's /etc/hosts and there is no entry with the host foobar.

Describe the results you expected:

127.0.0.1       localhost
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
172.17.0.2      foobar

Output of podman version:

Version:       0.10.1.3
Go Version:    go1.10.4
OS/Arch:       linux/amd64

Output of podman info:

host:
  BuildahVersion: 1.5-dev
  Conmon:
    package: podman-0.10.1.3-1.gitdb08685.fc28.x86_64
    path: /usr/libexec/podman/conmon
    version: 'conmon version 1.12.0-dev, commit: 4a03e555ee4105308fa4d814d4ce02a059af0b7f-dirty'
  Distribution:
    distribution: fedora
    version: "28"
  MemFree: 4620840960
  MemTotal: 16547115008
  OCIRuntime:
    package: runc-1.0.0-56.dev.git78ef28e.fc28.x86_64
    path: /usr/bin/runc
    version: 'runc version spec: 1.0.1-dev'
  SwapFree: 8346660864
  SwapTotal: 8346660864
  arch: amd64
  cpus: 4
  hostname: brql33992173a
  kernel: 4.18.16-200.fc28.x86_64
  os: linux
  uptime: 18h 21m 12.12s (Approximately 0.75 days)
insecure registries:
  registries: []
registries:
  registries:
  - docker.io
store:
  ContainerStore:
    number: 3
  GraphDriverName: overlay
  GraphOptions:
  - overlay.mountopt=nodev
  - overlay.override_kernel_check=true
  GraphRoot: /var/lib/containers/storage
  GraphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
  ImageStore:
    number: 1
  RunRoot: /var/run/containers/storage
@rhatdan
Copy link
Member

rhatdan commented Nov 1, 2018

It does not look like Docker does this, but it is probably not a bad idea.

@TomSweeneyRedHat
Copy link
Member

@mheon @rhatdan would this be build time addition rather than run? i.e. a Buildah enhancement?

@jfilak
Copy link
Author

jfilak commented Nov 1, 2018

It does not look like Docker does this, but it is probably not a bad idea.

Docker on Fedora does this:

# docker run -it --rm --hostname foobar centos cat /etc/hosts
127.0.0.1       localhost
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
172.17.0.3      foobar

# rpm -q docker
docker-1.13.1-61.git9cb56fd.fc28.x86_64

@jfilak
Copy link
Author

jfilak commented Nov 1, 2018

@TomSweeneyRedHat the things I am packing in images need to be installed and the current hostname is imbued into profiles and configurations.

So, I have to do this:
https://github.com/jfilak/snippets/tree/master/mock_hostname

Therefore, the possibility to specify hostname during build would be appreciated!

@mheon
Copy link
Member

mheon commented Nov 1, 2018

@TomSweeneyRedHat I think this is a Podman thing - we set hostname by default to container ID when we make containers in Podman (with option of user override).

@mheon
Copy link
Member

mheon commented Nov 1, 2018

(Though Buildah may want to do it as well, I don't think you necessarily want to include custom /etc/hosts changes in images - we don't on the Podman side.

@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 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
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.

5 participants