Kernel pid terminated

mqtt:
image: emqx/emqx:5.7.1
container_name: emqx
ports:
- “1883:1883”
- “8083:8083”
- “8084:8084”
- “8883:8883”
- “18083:18083”
volumes:
- /docker/emqx/data/:/opt/emqx/data
- /docker/emqx/log/:/opt/emqx/log
privileged: true
network_mode: “host”

network_mode 为host报错,默认不报错
报错内容:
hostname: Name or service not known
WARNING: Default (insecure) Erlang cookie is in use.
WARNING: Configure node.cookie in /opt/emqx/etc/emqx.conf or override from environment variable EMQX_NODE__COOKIE
WARNING: NOTE: Use the same cookie for all nodes in the cluster.
EMQX_RPC__PORT_DISCOVERY [rpc.port_discovery]: manual
EMQX_NODE__NAME [node.name]: emqx@
Kernel pid terminated (application_controller) (“{application_start_failure,kernel,{{shutdown,{failed_to_start_child,net_sup,{shutdown,{failed_to_start_child,net_kernel,{‘EXIT’,nodistribution}}}}},{kernel,start,[normal,]}}}”)

参考:12.04 - Why do I get hostname: Name or service not known error? - Ask Ubuntu

操作系统用的是:Alibaba Cloud Linux 3.2104 LTS 64位 等保2.0三级版

[root@iZ2ze8xqzashgyoxtjnc75Z ~]# hostname -i
172.23.24.208 172.18.0.1 172.17.0.1 fe80::216:3eff:fe38:3f8f

话说这个问题有解决吗

docker image 在找不到 hostname 的情况下,也可以选择通过环境变量强制设置他的 name 的。

EMQX_NODE__NAME: foo_emqx@127.0.0.1

查看:https://hub.docker.com/_/emqx

感谢,通过重置镜像hostname解决hostname: localhost
这个变量我也试了,没有问题