我想在从python docker sdk中提取图像时启用内容信任,但是目前我正在做:
export DOCKER_CONTENT_TRUST=1
然后在python3中执行:
import docker
client = docker.from_env()
client.images.pull('some-image-with-no-remote-trust-data')
但是它成功提取了图像。
这样做:
docker pull some-image-with-no-remote-trust-data
给我错误:Error: remote trust data does not exist...
使用python sdk进行提取时,我希望得到类似的错误,但我不...如何解决此问题?
答案 0 :(得分:0)
当前似乎不支持此功能-https://github.com/docker/docker-py/issues/1773
我建议使用子流程
import subprocess
ret = subprocess.run(['docker', 'pull', 'some-image-with-no-remote-trust-data'])
if ret.returncode:
# pull failed
pass