Open AntonOellerer opened 4 years ago
I have a similar problem when trying to run a java app inside a docker container which I start with podman-compose.
It seems that this is the line of code that causes the issue to appear
java.net.InetAddress.getLocalHost().getHostName()
The exception is:
Caused by: java.net.UnknownHostException: ec3086cec320: Name or service not known
I do not observe such an error when ruining the container with a regular docker-compose command.
My docker-compose.yml is :
version: '3.7'
networks:
my-network:
driver: bridge
...
java-backend:
image: java-backend:app
networks:
- my-network
depends_on:
- mysql
- redis
- zookeeper
- kafka
- elastic
build:
context: ./backend
dockerfile: Dockerfile
ports:
- '9000:9000'
I also wrote a test program in the container and tried to run it and failed with the same error.
Main.java
class Main {
public static void main(String[] args) throws Exception {
java.net.InetAddress.getLocalHost();
}
}
Stack Trace:
Exception in thread "main" java.net.UnknownHostException: ec3086cec320: ec3086cec320: Name or service not known
at java.base/java.net.InetAddress.getLocalHost(InetAddress.java:1642)
at Main.main(Main.java:5)
Caused by: java.net.UnknownHostException: ec3086cec320: Name or service not known
at java.base/java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.base/java.net.InetAddress$PlatformNameService.lookupAllHostAddr(InetAddress.java:929)
at java.base/java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1515)
at java.base/java.net.InetAddress$NameServiceAddresses.get(InetAddress.java:848)
at java.base/java.net.InetAddress.getAllByName0(InetAddress.java:1505)
at java.base/java.net.InetAddress.getLocalHost(InetAddress.java:1637)
... 1 more
java -version
openjdk version "11.0.7" 2020-04-14
OpenJDK Runtime Environment 18.9 (build 11.0.7+10)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.7+10, mixed mode)
I am using a development version as advised in the README on CentOS Linux 8 (Core)
podman-compose version
:
using podman version: podman version 1.6.4
podman-composer version 0.1.7dev
podman --version
podman version 1.6.4
0
I noticed that when running a container with docker-compose the hostname
of the container is added in /etc/hosts
Example:
root@bb7563cc0b43:/# hostname
bb7563cc0b43
root@bb7563cc0b43:/# cat /etc/hosts
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
172.19.0.7 bb7563cc0b43
While using podman-compose the hostname was missing in the containers /etc/hosts
I think this feature/bug request is related https://github.com/containers/podman-compose/issues/165
Hey, I am trying to create a hadoop cluster with podman, and for this cloned the docker-hadoop repository and ran
podman-compose up
. Starting of the NameNode fails with the following error:Because of this, the whole cluster is unable to start. I am using the latest development version as advised in the README on Fedora 31
podman-compose version
: