You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Impossible to get rootless + bridge network + container-to-host connectivity - using pasta
Steps to reproduce the issue
Hi,
I am struggling with the following:
I have a compose file with a bunch of services (Kafka, Mongo, etc) and running on a custom bridge network I created manually (let's call it my-bridge).
I then have a docker file that builds and runs a Java webapp (my-service-a) on my-bridge:
my-service-a needs to be able to communicate with those compose services (hence on the same network), e.g. consume Kafka messages.
my-service-a also exposes a REST API (which I consume from my host's browser or postman at localhost:8090). Some operations of this API cause my-service-a to perform REST calls to another app (my-service-b), which is running on my host instead, as a plain old JVM app.
my-service-a uses host name host.docker.internal in its configuration to indicate the host of my-service-b, so that it relies on name resolution and doesn't need to know a fixed IP address.
I'm quite sure that this used to work fine until very recently, so I dunno if my distro changed something, but the bottom line is, now this doesn't work anymore.
When starting my-service-a, I get this:
Error: failed to create new hosts file: unable to replace "host-gateway" of host entry "host.docker.internal:host-gateway": host containers internal IP address is empty
So I did some searching and stumbled upon some Issues in this project (e.g. #22653). I tried to apply the first recommendation mentioned here, to no avail.
I created ~/.config/containers/containers.conf with the following (how can I be sure this change is effective?):
Next, I have started my-service-a again, this time without the extra host (is this ok?):
docker run -p 8090:8080 --name=my-service-a --replace --net=my-bridge_default -d org.me/my-service-a
And I have changed my-service-a's app configuration so that instead of looking for my-service-b at host.docker.internal, it uses host.containers.internal (here also, is this ok?)
Now my-service-a starts just fine, but is unable to resolve host.containers.internal, therefore it's not forwarding calls to my-service-b:
Caused by: io.netty.resolver.dns.DnsResolveContext$SearchDomainUnknownHostException: Failed to resolve 'host.containers.internal' [A(1)] and search domain query for configured domains failed as well: [dns.podman]
What am I doing wrong?
Thanks
P.S. I have noticed that netavark-dhcp-proxy.socket/service were not running, so I enabled those via systemd, so that they start on every boot. Not sure it's correct/needed.
Describe the results you received
Error: failed to create new hosts file: unable to replace "host-gateway" of host entry "host.docker.internal:host-gateway": host containers internal IP address is empty at container startup
Describe the results you expected
Container starts on the assigned bridge network and is also able to reach a service running on the host
podman info output
host:
arch: amd64buildahVersion: 1.37.2cgroupControllers:
- memory
- pidscgroupManager: systemdcgroupVersion: v2conmon:
package: conmon-2.1.12-1.1.x86_64path: /usr/bin/conmonversion: 'conmon version 2.1.12, commit: unknown'cpuUtilization:
idlePercent: 94.41systemPercent: 1.31userPercent: 4.28cpus: 16databaseBackend: sqlitedistribution:
distribution: opensuse-tumbleweedversion: "20240823"eventLogger: journaldfreeLocks: 1206hostname: andromedaidMappings:
gidmap:
- container_id: 0host_id: 1000size: 1
- container_id: 1host_id: 100000size: 65536uidmap:
- container_id: 0host_id: 1000size: 1
- container_id: 1host_id: 100000size: 65536kernel: 6.10.5-1-defaultlinkmode: dynamiclogDriver: journaldmemFree: 1043873792memTotal: 32920047616networkBackend: netavarknetworkBackendInfo:
backend: netavarkdns:
package: aardvark-dns-1.12.1-1.1.x86_64path: /usr/libexec/podman/aardvark-dnsversion: aardvark-dns 1.12.1package: netavark-1.12.1-1.1.x86_64path: /usr/libexec/podman/netavarkversion: netavark 1.12.1ociRuntime:
name: crunpackage: crun-1.15-1.1.x86_64path: /usr/bin/crunversion: |- crun version 1.15 commit: e6eacaf4034e84185fd8780ac9262bbf57082278 rundir: /run/user/1000/crun spec: 1.0.0 +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +LIBKRUN +WASM:wasmedge +YAJLos: linuxpasta:
executable: /usr/bin/pastapackage: passt-20240814.61c0b0d-1.1.x86_64version: | pasta 20240814.61c0b0d-1.1 Copyright Red Hat GNU General Public License, version 2 or later <https://www.gnu.org/licenses/old-licenses/gpl-2.0.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.remoteSocket:
exists: truepath: /run/user/1000/podman/podman.sockrootlessNetworkCmd: pastasecurity:
apparmorEnabled: falsecapabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOTrootless: trueseccompEnabled: trueseccompProfilePath: /usr/share/containers/seccomp.jsonselinuxEnabled: trueserviceIsRemote: falseslirp4netns:
executable: ""package: ""version: ""swapFree: 69784563712swapTotal: 69789020160uptime: 1h 24m 44.00s (Approximately 0.04 days)variant: ""plugins:
authorization: nulllog:
- k8s-file
- none
- passthrough
- journaldnetwork:
- bridge
- macvlan
- ipvlanvolume:
- localregistries:
search:
- registry.opensuse.org
- registry.suse.com
- docker.iostore:
configFile: /home/andrea/.config/containers/storage.confcontainerStore:
number: 20paused: 0running: 7stopped: 13graphDriverName: overlaygraphOptions: {}graphRoot: /home/andrea/.local/share/containers/storagegraphRootAllocated: 707194257408graphRootUsed: 322045759488graphStatus:
Backing Filesystem: btrfsNative Overlay Diff: "true"Supports d_type: "true"Supports shifting: "false"Supports volatile: "true"Using metacopy: "false"imageCopyTmpDir: /var/tmpimageStore:
number: 437runRoot: /run/user/1000/containerstransientStore: falsevolumePath: /home/andrea/.local/share/containers/storage/volumesversion:
APIVersion: 5.2.2Built: 1724314016BuiltTime: Thu Aug 22 10:06:56 2024GitCommit: ""GoVersion: go1.22.6Os: linuxOsArch: linux/amd64Version: 5.2.2
Podman in a container
No
Privileged Or Rootless
Rootless
Upstream Latest Release
Yes
Additional environment details
opensuse Tumbleweed with SELinux enforcing
Additional information
Additional information like issue happens only occasionally or issue happens with a particular architecture or on a particular setting
The text was updated successfully, but these errors were encountered:
Just report these spam comments to github, when I see them I remove the comments but it seems github also quickly removes them (doesn't seem to prevent them from being posting in the first place unfortunately)
Issue Description
Impossible to get rootless + bridge network + container-to-host connectivity - using pasta
Steps to reproduce the issue
Hi,
I am struggling with the following:
I have a compose file with a bunch of services (Kafka, Mongo, etc) and running on a custom bridge network I created manually (let's call it my-bridge).
I then have a docker file that builds and runs a Java webapp (
my-service-a
) onmy-bridge
:my-service-a
needs to be able to communicate with those compose services (hence on the same network), e.g. consume Kafka messages.my-service-a
also exposes a REST API (which I consume from my host's browser or postman atlocalhost:8090
). Some operations of this API causemy-service-a
to perform REST calls to another app (my-service-b
), which is running on my host instead, as a plain old JVM app.my-service-a
uses host namehost.docker.internal
in its configuration to indicate the host ofmy-service-b
, so that it relies on name resolution and doesn't need to know a fixed IP address.I'm quite sure that this used to work fine until very recently, so I dunno if my distro changed something, but the bottom line is, now this doesn't work anymore.
When starting
my-service-a
, I get this:Error: failed to create new hosts file: unable to replace "host-gateway" of host entry "host.docker.internal:host-gateway": host containers internal IP address is empty
So I did some searching and stumbled upon some Issues in this project (e.g. #22653). I tried to apply the first recommendation mentioned here, to no avail.
I created
~/.config/containers/containers.conf
with the following (how can I be sure this change is effective?):Next, I have started
my-service-a
again, this time without the extra host (is this ok?):docker run -p 8090:8080 --name=my-service-a --replace --net=my-bridge_default -d org.me/my-service-a
And I have changed my-service-a's app configuration so that instead of looking for my-service-b at
host.docker.internal
, it useshost.containers.internal
(here also, is this ok?)Now
my-service-a
starts just fine, but is unable to resolvehost.containers.internal
, therefore it's not forwarding calls tomy-service-b
:Caused by: io.netty.resolver.dns.DnsResolveContext$SearchDomainUnknownHostException: Failed to resolve 'host.containers.internal' [A(1)] and search domain query for configured domains failed as well: [dns.podman]
What am I doing wrong?
Thanks
P.S. I have noticed that netavark-dhcp-proxy.socket/service were not running, so I enabled those via systemd, so that they start on every boot. Not sure it's correct/needed.
Describe the results you received
Error: failed to create new hosts file: unable to replace "host-gateway" of host entry "host.docker.internal:host-gateway": host containers internal IP address is empty
at container startupDescribe the results you expected
Container starts on the assigned bridge network and is also able to reach a service running on the host
podman info output
Podman in a container
No
Privileged Or Rootless
Rootless
Upstream Latest Release
Yes
Additional environment details
opensuse Tumbleweed with SELinux enforcing
Additional information
Additional information like issue happens only occasionally or issue happens with a particular architecture or on a particular setting
The text was updated successfully, but these errors were encountered: