import docker
client = docker.from_env(version='1.24', timeout=6)
# client
print(dir(client))
images = client.images
print(dir(images))
print(images.list(), "---\n", images.list(name="jenkins"), "---\n", images.list(all=True),"---\n", images.list(filters={"dangling": False}))
image = images.get("node")
print(image, dir(image))
print(images.list())
containers = client.containers
print(dir(containers))
#在運行的容器
print("running: ",containers.list())
print("all: ", containers.list(all=True))
images.pull("alpine", tag="latest")
# docker pull alpine後運行
containers.run('alpine', 'echo hello world')