def test_dind(python_testcontainer_image: str, tmp_path: Path) -> None:
    """
    Run selected tests in Docker in Docker
    """
    cert_dir = tmp_path / "certs"
    dind_name = f"docker_{SESSION_ID}"
    with Network() as network:
        with (
            DockerContainer(image="docker:dind", privileged=True)
            .with_name(dind_name)
            .with_volume_mapping(str(cert_dir), "/certs", "rw")
            .with_env("DOCKER_TLS_CERTDIR", "/certs/docker")
            .with_env("DOCKER_TLS_VERIFY", "1")
            .with_network(network)
            .with_network_aliases("docker")
        ) as dind_container:
            wait_for_logs(dind_container, "API listen on")
            client_dir = cert_dir / "docker" / "client"
            ca_file = client_dir / "ca.pem"
            assert ca_file.is_file()
            try:
                with (
                    DockerContainer(image=python_testcontainer_image)
                    .with_command("poetry run pytest -m inside_docker_check")
                    .with_volume_mapping(str(cert_dir), "/certs")
                    # for some reason the docker client does not respect
                    # DOCKER_TLS_CERTDIR and looks in /root/.docker instead
                    .with_volume_mapping(str(client_dir), "/root/.docker")
                    .with_env("DOCKER_TLS_CERTDIR", "/certs/docker/client")
                    .with_env("DOCKER_TLS_VERIFY", "1")
                    # docker port is 2376 for https, 2375 for http
                    .with_env("DOCKER_HOST", "tcp://docker:2376")
                    .with_network(network)
                ) as test_container:
                    status = test_container.get_wrapped_container().wait()
                    stdout, stderr = test_container.get_logs()
            finally:
                # ensure the certs are deleted from inside the container
                # as they might be owned by root it otherwise could lead to problems
                # with pytest cleanup
                dind_container.exec("rm -rf /certs/docker")
                dind_container.exec("chmod -R a+rwX /certs")

    # Show what was done inside test
    with print_surround_header("test_dood results"):
        print(stdout.decode("utf-8", errors="replace"))
        print(stderr.decode("utf-8", errors="replace"))
    assert status["StatusCode"] == 0

    Run selected tests in Docker in Docker
    
core/tests/test_docker_in_docker.py