Score:0

Docker for Windows hostname incorrect

tr flag

I'm trying to run DB2 via a Linux container on Docker for Windows Server 2019. The image is based on the offcial IBM DB2 docker image.

The problem is that in Docker for Windows the hostname in the NAT network is not just "hostname", it's "hostname.nat". DB2 needs the correct hostname to run.

When running the container using --network none the hostname is correct and DB2 runs but I have no port forwarding and the database is useless this way.

How to set the hostname correct?

# DB2 works but port forwarding does not
docker run -it --network none --name fis-testdb --hostname fis-testdb -p 50000:50000 db2 bash
[root@fis-testdb /]# ping fis-testdb
PING fis-testdb (127.0.0.2) 56(84) bytes of data.
64 bytes from fis-testdb (127.0.0.2): icmp_seq=1 ttl=64 time=0.014 ms
# Port forwarding works but DB2 does not
docker run -it --name fis-testdb --hostname fis-testdb -p 50000:50000 db2 bash
[root@fis-testdb /]# ping fis-testdb
PING fis-testdb (172.31.166.164) 56(84) bytes of data.
64 bytes from fis-testdb.nat (172.31.166.164): icmp_seq=1 ttl=64 time=0.027 ms

How to remove this ".nat" suffix?

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.