简体   繁体   English

使用docker-py获取docker偏好

[英]Get docker preferences using docker-py

I am trying to read the configs (preferences) set manually using docker preferences on mac from docker-py python module. 我正在尝试使用docker-py python模块在mac上使用docker偏好设置来手动读取配置(首选项)设置。

I see that these preferences are stored in ~/.docker/config.json but I don't seem to find a way to access them using docker client. 我看到这些首选项存储在〜/ .docker / config.json中,但是我似乎没有找到使用docker客户端访问它们的方法。

I am trying to access the preference, "Securely store Docker logins in macOS keychain" particularly. 我正在尝试访问首选项“特别是在macOS钥匙串中安全地存储Docker登录名”。

I see that we can set the config file using 我看到我们可以使用

docker --config 码头工人--config

but, there is no getter for this config file? 但是,此配置文件没有吸气剂吗?

I can see 'credsStore' property in the docker config.json but, when I try client.configs I get an empty list. 我可以在docker config.json中看到'credsStore'属性,但是当我尝试client.configs时,我得到一个空列表。

import docker
client = docker.from_env()
client.configs.list()

I would expect to see the value of that particular config. 我希望看到该特定配置的值。

You can't access client configuration information ( ~/docker/config.json ) via the Docker API. 您无法通过Docker API访问客户端配置信息( ~/docker/config.json )。 The information in that file effects the behavior of the client but it is not part of the API. 该文件中的信息会影响客户端的行为,但它不是API的一部分。

The configs method in the API is for accessing container configuration data in Docker Swarm (see " Store configuration data using Docker Configs "). API中的configs方法用于访问Docker Swarm中的容器配置数据(请参阅“ 使用Docker Configs存储配置数据 ”)。

You can find the complete Docker API reference here . 您可以在此处找到完整的Docker API参考。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM