-
Notifications
You must be signed in to change notification settings - Fork 767
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
Buildah intermediate container(Id) is not resolvable #4446
Comments
@flouthoc PTAL |
Hi @SaurabhAhuja1983 , I tried reproducing with the latest buildah I was unable to reproduce and java class was successfully able to resolve the hostname. Could you please try with latest buildah. Ignore the [fl@fedora bin]$ ./buildah build --layers --no-cache -t test .
STEP 1/3: FROM openjdk:latest
STEP 2/3: COPY MyClass.java .
--> 3d18cc7dcbf
STEP 3/3: RUN echo "---" ; cat /etc/hosts ; echo "Hostname: $(hostname)" ; echo "---"; javac MyClass.java ; /usr/bin/java -cp . MyClass
---
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.16 host.containers.internal
10.0.2.100 083ba9abf0aa 3d18cc7dcbf6-working-container
/bin/sh: hostname: command not found
Hostname:
---
hostname: 083ba9abf0aa
COMMIT test
--> 0b556a7f11c
Successfully tagged localhost/test:latest
0b556a7f11cc670e6c40d6405ddcff0427287902adff2251e00122ea130bcf38
[fl@fedora bin]$ ./buildah build --no-cache -t test .
STEP 1/3: FROM openjdk:latest
STEP 2/3: COPY MyClass.java .
STEP 3/3: RUN echo "---" ; cat /etc/hosts ; echo "Hostname: $(hostname)" ; echo "---"; javac MyClass.java ; /usr/bin/java -cp . MyClass
---
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.16 host.containers.internal
10.0.2.100 57de73bb13f4 openjdk-working-container
/bin/sh: hostname: command not found
Hostname:
---
hostname: 57de73bb13f4
COMMIT test
--> b0971b4e1ff
Successfully tagged localhost/test:latest
b0971b4e1ff224bd5161cf3be6c582ad7421dbf7d6dd54261f7fc22823c4cb81 FROM openjdk:latest
COPY MyClass.java .
RUN echo "---" ; cat /etc/hosts ; echo "Hostname: $(hostname)" ; echo "---"; javac MyClass.java ; /usr/bin/java -cp . MyClass Please feel free to try it out and comment back if you think issue is with buildah and I will reopen this. |
@flouthoc Thank you for reproducing the issue. But i still see the issue with latest buildah v 1.28.2
As you can see, i am using rootless buildah and not using slirp4netns i can see in your output entry in /etc/hosts
Are you using slirp4netns ? All i want is the ip -> containerId mapping in the /etc/hosts for rootless buildah. Can you please share the output with loglevel trace on. can you please reopen the issue. |
@flouthoc not sure if you saw my comment. Pinging again. |
@SaurabhAhuja1983 Thanks for reminding. I will try reproducing it again on a rootful env :) |
Thank You. |
I created the following patch and it seemed to work [added ip-> hostname mapping]
|
@flouthoc pinging again. Are you able to reproduce the issue? Can we please include the patch in buildah main repo. |
Could you open a PR with a test? |
Yes. Thank You. let me read the guidelines and procedure to contribute and open a PR. |
@rhatdan can you please re-open this issue. Sorry for coming back after months. We have been dealing with other buildah issues. I am creating a PR to fix this, you can please take a look and review. |
…ainers#4446 Signed-off-by: Saurabh Ahuja <nsit.saurabh@gmail.com>
Some tools depend on the hostname being present in /etc/hosts. I would argue they are broken but its not like we can do anything about that. This adds the hostname with the local host ip when the host network is used. For private networking we already add the hostname. We also now correctly force host networking in chroot mode, it was silently ignored before thus causing extra confusion here. Fixes containers#4446 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Some tools depend on the hostname being present in /etc/hosts. I would argue they are broken but its not like we can do anything about that. This adds the hostname with the local host ip when the host network is used. For private networking we already add the hostname. We also now correctly force host networking in chroot mode, it was silently ignored before thus causing extra confusion here. Fixes containers#4446 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Some tools depend on the hostname being present in /etc/hosts. I would argue they are broken but its not like we can do anything about that. This adds the hostname with the local host ip when the host network is used. For private networking we already add the hostname. We also now correctly force host networking in chroot mode, it was silently ignored before thus causing extra confusion here. Fixes containers#4446 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Discussed in #4424
Originally posted by SaurabhAhuja1983 November 18, 2022
Docker is assigning ipaddress to each intermediate container and containerId is resolvable. But buildah intermediate containerId is not resolvable...
However the same code works fine with docker build as i could see the intermediate containerId to IP mapping in /etc/hosts.
Not sure if buildah intermediate container is not assigned an ipaddress but it's blocking our java projects from getting build as we are transitioning from docker to buildah for building images.
The text was updated successfully, but these errors were encountered: