containers / podman

Podman: A tool for managing OCI containers and pods.
https://podman.io
Apache License 2.0
23.17k stars 2.36k forks source link

have an IP assigned to the container during build time #23745

Closed raffaelespazzoli closed 3 weeks ago

raffaelespazzoli commented 4 weeks ago

Feature request description

this is a feature request for the discussion had in this issue #11302 I find myself in a similar situation when trying to follow these instructions: https://github.com/oracle/docker-images/blob/main/OracleDatabase/RAC/OracleRealApplicationClusters/README.md#oracle-rac-container-image-for-podman

This is the error I get:

Launching Oracle Grid Infrastructure Setup Wizard...

[FATAL] [INS-40954] Local node 23648b8b329c.containers.internal did not resolve to an IP address. Provide alternative name that resolves to an IP address.

Suggest potential solution

an ip is assigned to the temp container during build so any software trying to resolve the name gets a positive answer. The behavior should be the same as in docker.

Have you considered any alternatives?

yes, building the image with docker, but it's not ideal.

Additional context

Add any other context or screenshots about the feature request here.

Luap99 commented 3 weeks ago

It is not clear what you are asking here and what the requirements are. I am not going to debug their image to figure out what they expect.

By default all build containers have a ip unless you run with something like --network none so your request doesn't make sense to me. And

23648b8b329c.containers.internal

That is not a valid hostname that we resolve and it would be news to me if docker resolves that name.

raffaelespazzoli commented 3 weeks ago

@Luap99 the attached issue has a well-done in-depth analysis of the problem. Here is the relevant excerpt:

Where I do get the issue is with buildah when trying to build the image, specifically with the bud option in my case to leverage a Dockerfile. buildah actually seems to handle the networking differently. It does generate a hostname for the intermediate container but it does not assign a public IP address for it.
The /etc/hosts file instead looks like this:

# Generated by Buildah
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
127.0.0.1   afccf1dcca9d
::1         afccf1dcca9d

so it looks like buildah does not setup networking for temp containers as usual when used with the bud option.

I just built the image with docker successfully, so at the very least I can confirm that that procedure works with docker.

Luap99 commented 3 weeks ago

What podman version are you using? This has been fixed a long time ago.

...
STEP 2/2: RUN cat /etc/hosts
127.0.0.1       localhost localhost.localdomain localhost4 localhost4.localdomain4
::1     localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.122.1   host.containers.internal host.docker.internal
192.168.188.25  c9f8e86d781f alpine-working-container
raffaelespazzoli commented 3 weeks ago
podman version
Client:       Podman Engine
Version:      5.2.1
API Version:  5.2.1
Go Version:   go1.22.5
Built:        Tue Aug 13 20:00:00 2024
OS/Arch:      linux/amd64