我正在开发 docker api python 客户端,我已经成功完成了构建映像,但现在我需要将该 docker 映像推送到 dockerhub 存储库。
这是我尝试过的:
来自views.py
client = docker.from_env()
client.images.build(path=docker_folder, gzip=False, tag=deployment.name)
image = client.images.get(deployment.name)
print(image.short_id)
print("start pushing your docker image to docker hub")
auth_config = {
'username': '***dockerhub-email ***',
'password': '***Password***',
}
client.images.push('arycloud/istiogui', tag=deployment.name,
auth_config=auth_config)
它不返回任何错误,但图像未推送到 docker hub reoritoy 上。这是我正在使用的存储库:
@Tarun 评论后更新代码
client = docker.from_env()
print("Start Building your docker image...")
client.images.build(path=docker_folder, gzip=False, tag=deployment.name)
image = client.images.get(deployment.name)
print(image.short_id)
print("start pushing your docker image to docker hub")
client.login(username='***', password='***')
client.images.push('arycloud/istiogui', tag=deployment.name)
之后我的图像仍然没有推送到 dockerhub 上!