Skip to content

Testcontainers images should not default to DockerHub #3276

@Bhuff1

Description

@Bhuff1

Description
ZMSTestUtils uses Testcontainers which defaults to pulling images from Docker Hub. This causes issues in enterprise CI/CD environments that:

  1. Cannot access Docker Hub directly (firewall restrictions)
  2. Require pulling images from internal registries

Affected images
MySQL container - Used for database tests
Ryuk container - Testcontainers' resource reaper for cleanup

Proposed Solution
Require explicit configuration via environment variables

  • ZMS_TEST_MYSQL_IMAGE
  • TESTCONTAINERS_RYUK_CONTAINER_IMAGE

Update ZMSTestUtils

private static final String MYSQL_IMAGE_ENV_VAR = "ZMS_TEST_MYSQL_IMAGE";
private static final String DEFAULT_MYSQL_IMAGE = "mysql/mysql-server:8.0";

public static String getMySQLImage() {
    String image = System.getenv("ZMS_TEST_MYSQL_IMAGE");
    if (image == null || image.isEmpty()) {
        image = DEFAULT_MYSQL_IMAGE; // fallback to default if no image specified
    }
    return image;
}

public static MySQLContainer startMemoryMySQL(final String userName, final String password) {
   final String mysqlImage = getMySQLImage();
   ...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions