基于 TLS 的 docker 守护进程正在 EC2 主机上运行。
docker 守护进程本地的 docker 客户端工作正常,但docker-compose
出现以下错误:
$ export DOCKER_HOST=tcp://172.31.3.2:2376 DOCKER_TLS_VERIFY=1
ubuntu@ip-172-31-3-2:~$ docker --tls image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest fce289e99eb9 8 months ago 1.84kB
ubuntu@ip-172-31-3-2:~$ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest fce289e99eb9 8 months ago 1.84kB
ubuntu@ip-172-31-3-2:~$ docker-compose -f jenkinsDocker/docker-compose.yml -p jenkins build
Building slavedotnet
ERROR: SSL error: HTTPSConnectionPool(host='172.31.3.2', port=2376): Max retries exceeded with url: /v1.21/build?q=False&pull=False&t=jenkins_slavedotnet&nocache=False&forcerm=False&rm=True (Caused by SSLError(SSLError(1, u'[SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:727)'),))
ubuntu@ip-172-31-3-2:~$
以下是创建服务器证书之前使用的配置文件。
{
"CN":"ec2-35-18x-xxx-xxx.ca-central-1.compute.amazonaws.com",
"hosts": [
"ec2-35-1xx-xxx-xxx.ca-central-1.compute.amazonaws.com",
"ip-172-31-3-2.ca-central-1.compute.internal",
"35.18x.xxx.xxx",
"172.31.3.2"
],
"Key": {
"algo": "rsa",
"size": 4096
},
"names": [
{
"C": "Canada",
"ST": "Saskatchewan",
"L": "Regina",
"O": "100000 Canada Inc.",
"OU": "Engineering"
}
]
}
这里是docker-compose
工具的 yml 文件。
为什么docker-compose
无法使用 TLS 连接到 docker daemon?