示例#1
0
def run_good_attached():
    container_name = 'test'

    img_registry = DefaultDockerRegistry()
    img = DockerImage('mike0sv/ebaklya', registry=img_registry)
    instance = DockerContainer(container_name, ports_mapping={80: 8080})
    host = DockerHost()

    runner = DockerRunner()
    runner.run(instance, img, host, detach=False, rm=True)
示例#2
0
def run_detached_and_remove():
    container_name = 'test'

    img_registry = DefaultDockerRegistry()
    img = DockerImage('test_broken_image', registry=img_registry)
    instance = DockerContainer(container_name)
    host = DockerHost()

    runner = DockerRunner()
    runner.run(instance, img, host, detach=True, rm=True)
示例#3
0
def run_attached():
    container_name = 'test'

    img_registry = DefaultDockerRegistry()
    img = DockerImage('test_broken_image', registry=img_registry)
    instance = DockerContainer(container_name, ports_mapping={80: 8080})
    host = DockerHost()

    runner = DockerRunner()
    runner.run(instance, img, host, detach=False, rm=False)
示例#4
0
def _check_runner(runner, img, host='', **kwargs):
    runner = runner(host, img, CONTAINER_NAME)
    instance = DockerContainer(CONTAINER_NAME, ports_mapping={80: 8080})
    env = DockerHost(host)

    assert not runner.is_running(instance, env)

    runner.run(instance, img, env, **kwargs)
    time.sleep(.1)

    assert runner.is_running(instance, env)

    runner.stop(instance, env)
    time.sleep(.1)

    assert not runner.is_running(instance, env)