nerdctl icon indicating copy to clipboard operation
nerdctl copied to clipboard

hostname is always overwritten by container id in container when using --network=host

Open shilaidun opened this issue 2 years ago • 0 comments

Description

Restart the container every time , hostname is always overwritten by container id in container when using --network=host,but the hostname in the container will change at any time, after restarting the container it changes to the container id AGAIN!

Steps to reproduce the issue

1.nerdctl run --network=host -v /etc/resolv.conf:/etc/resolv.conf -v /etc/hosts:/etc/hosts -v /etc/hostname:/etc/hostname --privileged=true images:v1.0.0 --name=test
2.nerdctl exec -it test bash 3.hostname : it shows container id a7e60e651786 4.echo 'myhost' > /etc/hostname && hostname 'myhost' 5.restart the container 6.nerdctl exec -it test bash 7.hostname: it shows container id a7e60e651786 AGAIN! not named 'myhost'

Describe the results you received and expected

hostname : it shows myhost

What version of nerdctl are you using?

1.7.0

Are you using a variant of nerdctl? (e.g., Rancher Desktop)

None

Host information

No response

shilaidun avatar Dec 11 '23 03:12 shilaidun