coding CD报错: docker: No port specified: :<empty>
docker: No port specified: :<empty>报错
报错如下
原因分析
根据报错分析,可判断原因为CD部分映射问题,即:docker port的映射。
检查CI的传参
def request_json = ["U_LIMIT": "${U_LIMIT}", "M_LIMIT": "${M_LIMIT}", "APP_PORT": "${APP_PORT}", "HTTP_PORT": "${HTTP_PORT}", "MOUNT": "${MOUNT}", "INSTANCE_NAME": "${INSTANCE_NAME}", "J_OPTS": "${J_OPTS}", "DUBBO_BINDS": "${DUBBO_BINDS}", "DOCKER_IMAGE_URL": "${DOCKER_IMAGE_URL}"];
检查CD的映射
发现多映射一个xxl-job的端口,去掉后解决
sudo docker run -d ${trigger["payload"].U_LIMIT} -m ${trigger["payload"].M_LIMIT} -p ${trigger["payload"].HTTP_PORT}:8081 -p ${trigger["payload"].APP_PORT}:${trigger["payload"].APP_PORT} -p ${trigger["payload"].JOB_EXECUTOR_PORT}:${trigger["payload"].JOB_EXECUTOR_PORT} ${trigger["payload"].MOUNT} --name ${trigger["payload"].INSTANCE_NAME} -e "JAVA_OPTS=${trigger["payload"].J_OPTS} -Dspring.cloud.nacos.discovery.ip=${APP_ADDRESS} -Dxxl.job.executor.address=http://${APP_ADDRESS}:${trigger["payload"].JOB_EXECUTOR_PORT}" -e DUBBO_IP_TO_REGISTRY=${APP_ADDRESS} -e spring.cloud.nacos.discovery.ip=${APP_ADDRESS} -e DUBBO_PORT_TO_REGISTRY=${trigger["payload"].APP_PORT} -e TZ=Asia/Shanghai --restart=always ${trigger["payload"].DOCKER_IMAGE_URL}
解决后的CD
sudo docker run -d ${trigger["payload"].U_LIMIT} -m ${trigger["payload"].M_LIMIT} -p ${trigger["payload"].HTTP_PORT}:8081 -p ${trigger["payload"].APP_PORT}:${trigger["payload"].APP_PORT} ${trigger["payload"].MOUNT} --name ${trigger["payload"].INSTANCE_NAME} -e "JAVA_OPTS=${trigger["payload"].J_OPTS} -Dspring.cloud.nacos.discovery.ip=${APP_ADDRESS} -Dxxl.job.executor.address=http://${APP_ADDRESS}:${trigger["payload"].JOB_EXECUTOR_PORT}" -e DUBBO_IP_TO_REGISTRY=${APP_ADDRESS} -e spring.cloud.nacos.discovery.ip=${APP_ADDRESS} -e DUBBO_PORT_TO_REGISTRY=${trigger["payload"].APP_PORT} -e TZ=Asia/Shanghai --restart=always ${trigger["payload"].DOCKER_IMAGE_URL}