我正在尝试使用SSL获得领事。我创建了自己的证书颁发机构(CA)cacert.pem,并为localhost创建了localhost.pem证书。当前的工作目录如下所示。
certs/cacert.pem
certs/localhost.pem
config/config.json
docker-compose.yml
Dockerfile
Dockerfile:
FROM consul:0.7.5
ADD ./config /consul/config/
ADD ./certs /certs/
ENTRYPOINT ["/bin/consul", "agent", "-server", "-bootstrap-expect=1", "-ui", "-data-dir=/consul/data", "-client=0.0.0.0"]
搬运工-compose.yml:
version: "2"
services:
myconsul:
image: myconsul:0.7.5
volumes:
- /consul/data
- /consul/config
ports:
- "8300:8300"
- "8400:8400"
- "8500:8500"
- "8600:8600"
- "8080:8080"
command: agent -server -bootstrap-expect=1 -ui -client=0.0.0.0
config.son:
{
"data_dir": "/consul/data",
"config_dir": "/consul/config",
"log_level": "INFO",
"server": true,
"addresses": {
"https": "0.0.0.0"
},
"ports": {
"https": 8080
},
"cert_file": "/certs/localhost.pem",
"ca_file": "/certs/cacert.pem"
}
我通过以下方式建立领事图像:docker build -t myconsul:0.7.5。 并运行consul容器:docker-compose up -d
http://192.168.99.100:8500/有效,但是如果我用localhost替换ip地址则不起作用 https://192.168.99.100:8080/不起作用
问题:
任何人都可以提供帮助?我有什么地方可以发布这样的问题吗?
答案 0 :(得分:1)
你几乎拥有它,只是:
1.-从config.json删除“config_dir”:“/ consul / config”
2.-将key_file添加到config.json
3.-在docker-compose.yml中添加-config-dir = / consul / config(在命令的末尾)