Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
docker py和build and push AttributeError:';图像';对象没有属性';推动';_Docker - Fatal编程技术网

docker py和build and push AttributeError:';图像';对象没有属性';推动';

docker py和build and push AttributeError:';图像';对象没有属性';推动';,docker,Docker,如何使用docker py构建并推送到服务器 docker_path = "/path/to/dockerfile/puredocker" build_image = docker_client.images.build(path=docker_path,tag=tag) image = build_image[0] print ('build_image:',build_image) for line in image.push(registry_na

如何使用docker py构建并推送到服务器

    docker_path = "/path/to/dockerfile/puredocker"
    build_image = docker_client.images.build(path=docker_path,tag=tag)
    image = build_image[0]
    print ('build_image:',build_image)

    for line in image.push(registry_name, stream=True):
        print (line)
我的形象不是这样吗

build_image: (<Image: 'testme:latest'>, <itertools._tee object at 0x10d9d0ec8>)

我认为你应该使用
get
方法

   docker_path = "/path/to/dockerfile/puredocker"
   client.images.build(path=docker_path, tag=tagged)
   image = client.images.get(<the name of the image>)
   print(image.short_id)
   client.images.push('registry/registry', tag=tagged)
docker_path=“/path/to/dockerfile/puredocker”
client.images.build(path=docker\u path,tag=taged)
image=client.images.get()
打印(图像。短\u id)
client.images.push('registry/registry',tag=taged)

   docker_path = "/path/to/dockerfile/puredocker"
   client.images.build(path=docker_path, tag=tagged)
   image = client.images.get(<the name of the image>)
   print(image.short_id)
   client.images.push('registry/registry', tag=tagged)