@Test
    public void testHostNetworkContainer() {
        try (
            GenericContainer<?> container = new GenericContainer<>(TestImages.TINY_IMAGE)
                .withStartupCheckStrategy(new OneShotStartupCheckStrategy())
                .withCommand("true")
                .withNetworkMode("host")
        ) {
            container.start();
            NetworkSettings networkSettings = container.getContainerInfo().getNetworkSettings();

            assertThat(networkSettings.getNetworks()).as("only one network is set").hasSize(1);
            assertThat(networkSettings.getNetworks()).as("network is 'host'").containsKey("host");
        }
    }
Simple tests of named network modes - more may be possible, but may not be reproducible
without other setup steps.
core/src/test/java/org/testcontainers/junit/DockerNetworkModeTest.java