@Test
    public void sharedMemorySetTest() {
        try (
            GenericContainer containerWithSharedMemory = new GenericContainer<>(TestImages.TINY_IMAGE)
                .withSharedMemorySize(42L * FileUtils.ONE_MB)
                .withStartupCheckStrategy(new OneShotStartupCheckStrategy())
        ) {
            containerWithSharedMemory.start();

            HostConfig hostConfig = containerWithSharedMemory.getContainerInfo().getHostConfig();
            assertThat(hostConfig.getShmSize())
                .as("Shared memory not set on container")
                .isEqualTo(42L * FileUtils.ONE_MB);
        }
    }
Create a container with an extra host entry and expose the content of /etc/hosts for testing.
core/src/test/java/org/testcontainers/junit/GenericContainerRuleTest.java