Perforce P4 error: Unable to determine client host name: %s584d0eac1b29: 584d0eac1b29: Name or service not known
Jenknis 增加 P4 凭证后,测试服务器是否正常;
报错:Unable to connect to: p4java://xxx.xxx.xxx.xxx:1666
Unable to determine client host name: %s584d0eac1b29: 584d0eac1b29: Name or service not known
因为 Jenkins 是用 Docker 启动,所以 P4 服务器无法识别客户端(Jenkins)的 hostname(584d0eac1b29)
# docker ps
584d0eac1b29 qa/jenkins:latest "/usr/bin/tini -- /u…" 6 minutes ago Up 6 minutes 0.0.0.0:8089->8089/tcp, 8080/tcp, 0.0.0.0:50000->50000/tcp qa-jenkins
步骤:
# cat /etc/hosts
127.0.0.1 localhost qa-jenkins
docker run -d --rm \
-p 8089:8089 \
-p 50000:50000 \
-v jenkins_home:/var/jenkins_home \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /etc/hosts:/etc/hosts \
--network=host \
--name qa-jenkins \
qa/jenkins:latest