简体   繁体   English

默认情况下如何保护 docker 客户端连接?

[英]How to secure docker client connection by default?

I'm using https to protect the docker daemon socket.我正在使用 https 来保护 docker 守护程序套接字。 Followed all the steps as mentioned here .遵循此处提到的所有步骤。 The environment variables are set as below,环境变量设置如下,

  • DOCKER_TLS_VERIFY=1 DOCKER_TLS_VERIFY=1
  • DOCKER_CERT_PATH=~/.docker == All my client, ca & server certificates + keys exist here DOCKER_CERT_PATH=~/.docker == 我所有的客户端、CA 和服务器证书 + 密钥都存在这里
  • DOCKER_HOST=tcp://$HOST:2376 DOCKER_HOST=tcp://$HOST:2376

The below command works (when I pass ca, client certificate & key):以下命令有效(当我通过 ca、客户端证书和密钥时):

docker --tlsverify --tlscacert=~/.docker/ca.pem --tlscert=~/.docker/client-cert.pem --tlskey=~/.docker/client-key.pem -H=$HOST:2376 ps

According to Docker documentation , I can secure docker client connections by default and do not need to pass certificates every time but the command "docker ps", doesn't work for me.根据Docker 文档,我可以默认保护 docker 客户端连接,并且不需要每次都通过证书,但是命令“docker ps”对我不起作用。 It always expects client certificate to be passed.它总是希望通过客户端证书。

I also tried executing the below,我也尝试执行以下,

docker-compose --tlsverify --tlscacert=~/.docker/ca.pem --tlscert=~/.docker/client-cert.pem --tlskey=~/.docker/client-key.pem -H=$HOST:2376  up

ERROR: TLS configuration is invalid - make sure your DOCKER_TLS_VERIFY and DOCKER_CERT_PATH are set correctly

How can I secure the docker client connections by default?默认情况下,如何保护 docker 客户端连接? I just want to execute like "docker ps" without passing client certificate every time since it already exists in ~/.docker我只想像“docker ps”一样执行而不每次都通过客户端证书,因为它已经存在于 ~/.docker

I have also referred a similar question here我在这里也提到了一个类似的问题

I found the answer myself.我自己找到了答案。 The client certificate and key generated are having the names as cert.pem and key.pem when I followed the official documentation instructions .当我按照官方文档说明进行操作时,生成的客户端证书和密钥的名称分别为 cert.pem 和 key.pem。 I renamed the cert.pem to client-cert.pem and key to client-key.pem in my ~/.docker directory.我在 ~/.docker 目录中将 cert.pem 重命名为 client-cert.pem 并将密钥重命名为 client-key.pem。

Apparently, docker picks the client certificate by default, only if it has name as cert.pem and key.pem.显然,docker 默认选择客户端证书,前提是它的名称为 cert.pem 和 key.pem。 So, my issue here is because of changing the client certificate / key names.所以,我的问题是因为更改了客户端证书/密钥名称。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 pycharm 在远程服务器上的远程 docker 上设置安全连接 - How to setup a secure connection on remote docker on remote server with pycharm Bluemix Secure Gateway Docker客户端的高可用性 - High Availability for Bluemix Secure Gateway Docker Client 错误:附加到正在运行的容器 - Docker 远程容器时,客户端网络套接字在建立安全 TLS 连接之前断开连接 - Error: Client network socket disconnected before secure TLS connection was established when attach to running container -Docker remote container 如何在 Docker 映像中运行 Signalr Blazor 客户端的 StartAsync 连接? - how to run StartAsync connection of signalr blazor client in docker image? Neo4j-如何使用Docker映像从安全连接访问Bolt? - Neo4j - How to access bolt from a secure connection using Docker image? 如何使用iptables保护docker容器 - how to secure docker containers with iptables 如何在 Docker 容器中运行的 tcp 客户端/服务器与在外部设备中运行的 tcp 服务器/客户端之间建立连接? - How to establish a connection between a tcp client/server running in a Docker container and a tcp server/client running in an external device? 带有Docker的Python客户端服务器-连接被拒绝 - Python Client Server with Docker - Connection refused 在Docker客户端中使用默认的容器名称作为默认名称 - Use last container name as default in docker client 弹簧客户端与 docker 和 gradle 的连接被拒绝 - Connection refused on spring-client with docker and gradle
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM