containers / podman-compose

a script to run docker-compose.yml using podman
GNU General Public License v2.0
5.08k stars 484 forks source link

Failure when trying to start a docker-hadoop cluster #131

Open AntonOellerer opened 4 years ago

AntonOellerer commented 4 years ago

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:

java.io.IOException: java.lang.RuntimeException: Could not resolve Kerberos principal name: java.net.UnknownHostException: 2027a5c01347: 2027a5c01347: Name or service not known
        at org.apache.hadoop.http.HttpServer2.<init>(HttpServer2.java:553) 
        at org.apache.hadoop.http.HttpServer2.<init>(HttpServer2.java:119)
        at org.apache.hadoop.http.HttpServer2$Builder.build(HttpServer2.java:433) 
        at org.apache.hadoop.hdfs.server.namenode.NameNodeHttpServer.start(NameNodeHttpServer.java:164)
        at org.apache.hadoop.hdfs.server.namenode.NameNode.startHttpServer(NameNode.java:885)                    
        at org.apache.hadoop.hdfs.server.namenode.NameNode.initialize(NameNode.java:707)                                                                                                                                                      
        at org.apache.hadoop.hdfs.server.namenode.NameNode.<init>(NameNode.java:953)         
        at org.apache.hadoop.hdfs.server.namenode.NameNode.<init>(NameNode.java:926)
        at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1692)
        at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1759)
Caused by: java.lang.RuntimeException: Could not resolve Kerberos principal name: java.net.UnknownHostException: 2027a5c01347: 2027a5c01347: Name or service not known
        at org.apache.hadoop.security.AuthenticationFilterInitializer.getFilterConfigMap(AuthenticationFilterInitializer.java:86)
        at org.apache.hadoop.http.HttpServer2.getFilterProperties(HttpServer2.java:665)
        at org.apache.hadoop.http.HttpServer2.constructSecretProvider(HttpServer2.java:655)
        at org.apache.hadoop.http.HttpServer2.<init>(HttpServer2.java:546)
        ... 9 more                                                                                                     
Caused by: java.net.UnknownHostException: 2027a5c01347: 2027a5c01347: Name or service not known
        at java.net.InetAddress.getLocalHost(InetAddress.java:1506)
        at org.apache.hadoop.security.SecurityUtil.getLocalHostName(SecurityUtil.java:259)
        at org.apache.hadoop.security.SecurityUtil.replacePattern(SecurityUtil.java:227)
        at org.apache.hadoop.security.SecurityUtil.getServerPrincipal(SecurityUtil.java:182)
        at org.apache.hadoop.security.AuthenticationFilterInitializer.getFilterConfigMap(AuthenticationFilterInitializer.java:83)
        ... 12 more
Caused by: java.net.UnknownHostException: 2027a5c01347: Name or service not known
        at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method)
        at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:929)
        at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1324)
        at java.net.InetAddress.getLocalHost(InetAddress.java:1501)
        ... 16 more

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:

podman-composer version  0.1.6dev
podman --version
podman version 1.8.1
0
NewestUser commented 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
NewestUser commented 4 years ago

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