-
I have a need to check /etc/hosts file in oci-hook and in some cases even make changes to the hosts file. This actually worked fine while using slirp4netns, but after changing to pasta (it looks like that at least) it seems that /etc/hosts is updated much later or then some issue with the namespace. So the hook is in stage "createRuntime", but tried also poststart. The path where I'm looking for is got from config container root and looks about like this: I even tried to create a file to /etc/ in stage createRuntime, and that worked fine. The hook is joined to containers mnt namespace. Should this even work? Is there a way to read and edit /etc/hosts using a oci-hook, when pasta is used? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
There is no difference between pasta and slirp4netns when it comes to creating/writing the hosts file (of course ips in the file might differ). We write the hosts file after the runtime creates the container (this is a recent change so this might be the cause for your chnage). Anyway running it as the |
Beta Was this translation helpful? Give feedback.
There is no difference between pasta and slirp4netns when it comes to creating/writing the hosts file (of course ips in the file might differ). We write the hosts file after the runtime creates the container (this is a recent change so this might be the cause for your chnage). Anyway running it as the
startContainer
hook should work. Of course at this moment you are already in the container namespace so there you need to open /etc/hosts directly.