Docker compose support

Allows to spin up services configured via docker-compose.yml.

class testcontainers.compose.DockerCompose(filepath, compose_file_name='docker-compose.yml', pull=False, env_file=None)

Docker compose containers.

Example

with DockerCompose("/home/project",
                   compose_file_name=["docker-compose-1.yml", "docker-compose-2.yml"],
                   pull=True) as compose:
    host = compose.get_service_host("hub", 4444)
    port = compose.get_service_port("hub", 4444)
    driver = webdriver.Remote(
        command_executor=("http://{}:{}/wd/hub".format(host,port)),
        desired_capabilities=CHROME,
    )
    driver.get("http://automation-remarks.com")
    stdout, stderr = compose.get_logs()
    if stderr:
        print("Errors\n:{}".format(stderr))
hub:
image: selenium/hub
ports:
- "4444:4444"
firefox:
image: selenium/node-firefox
links:
    - hub
expose:
    - "5555"
chrome:
image: selenium/node-chrome
links:
    - hub
expose:
    - "5555"