コード例 #1
0
def test_docker_build_with_dockerfile():
    docker = DockerClient()

    dockerfile = open(
        os.path.dirname(os.path.realpath(__file__)) + "/Dockerfile").read()

    docker.build(dockerfile=dockerfile, tag="my_container_2")
    out = docker.images("my_container_2")
    pprint(out)
    assert len(out) == 1
    assert out[0]['RepoTags'][0] == 'my_container_2:latest'
コード例 #2
0
def test_docker_build():
    dockerfile = """
                FROM busybox:buildroot-2014.02
                MAINTAINER first last, [email protected]
                VOLUME /data
                CMD ["/bin/sh"]
                """

    docker = DockerClient()
    docker.build(dockerfile=dockerfile, tag="my_container")
    out = docker.images("my_container")
    pprint(out)
    assert len(out) == 1
    assert out[0]['RepoTags'][0] == 'my_container:latest'