nerdctl icon indicating copy to clipboard operation
nerdctl copied to clipboard

Starting the container with nerdctl will change the inode of /etc/hostname

Open zhangwendongvip opened this issue 1 year ago • 1 comments

Description

Starting the container with nerdctl will change the inode of /etc/hostname, causing the mounting of /etc/hostname to fail. Restarting the container will not inherit the /etc/hostname outside the container, which is determined to be a bug in nerdctl

Steps to reproduce the issue

1.Inconsistent Inode found inside and outside the /etc/hostname file container through stat 2.Host mode found default mounting of/etc/hostname 3.Causing mounting failure

Describe the results you received and expected

nerdctl starts the container without changing the inode of /etc/hostname

What version of nerdctl are you using?

nerdctl version 1.7.2

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

None

Host information

No response

zhangwendongvip avatar Jan 02 '24 03:01 zhangwendongvip

Is this a recent regression?

AkihiroSuda avatar Jan 03 '24 02:01 AkihiroSuda

@zhangwendongvip could you clarify how to reproduce?

nerdctl DOES mount /etc/hostname on its own - this is on purpose - I am not sure if you are trying to mount /etc/hostname yourself on top of that? If that is the case, and if all you want is to change the hostname of a container, you can just use the --hostname flag on run.

Currently on v2/main:

stat ~/.local/share/nerdctl/1935db59/containers/default/3f9905e20580a0494e3beac000da0a3cfec5c2d62190bdbc2dda445c155a4fa4/hostname
 	Inode: 2103942

nerdctl exec test2 stat /etc/hostname
 	Inode: 2103942

nerdctl restart test2

nerdctl exec test2 stat /etc/hostname
 	Inode: 2103942

This all seems fine.

Am I missing something?

apostasie avatar Aug 29 '24 06:08 apostasie