@@ -273,36 +273,26 @@ func RunContainer(ctx context.Context, opts ...testcontainers.ContainerCustomize
273273
274274// Run creates an instance of the Registry container type
275275func Run (ctx context.Context , img string , opts ... testcontainers.ContainerCustomizer ) (* RegistryContainer , error ) {
276- req := testcontainers.ContainerRequest {
277- Image : img ,
278- ExposedPorts : []string {registryPort },
279- Env : map [string ]string {
276+ moduleOpts := []testcontainers.ContainerCustomizer {
277+ testcontainers .WithExposedPorts (registryPort ),
278+ testcontainers .WithEnv (map [string ]string {
280279 // convenient for testing
281280 "REGISTRY_STORAGE_DELETE_ENABLED" : "true" ,
282- },
283- WaitingFor : wait .ForHTTP ("/" ).
284- WithPort (registryPort ).
285- WithStartupTimeout (10 * time .Second ),
281+ }),
282+ testcontainers .WithWaitStrategy (
283+ wait .ForHTTP ("/" ).
284+ WithPort (registryPort ).
285+ WithStartupTimeout (10 * time .Second ),
286+ ),
286287 }
287288
288- genericContainerReq := testcontainers.GenericContainerRequest {
289- ContainerRequest : req ,
290- Started : true ,
291- }
292-
293- for _ , opt := range opts {
294- if err := opt .Customize (& genericContainerReq ); err != nil {
295- return nil , err
296- }
297- }
298-
299- container , err := testcontainers .GenericContainer (ctx , genericContainerReq )
289+ container , err := testcontainers .Run (ctx , img , append (moduleOpts , opts ... )... )
300290 var c * RegistryContainer
301291 if container != nil {
302292 c = & RegistryContainer {Container : container }
303293 }
304294 if err != nil {
305- return c , fmt .Errorf ("generic container : %w" , err )
295+ return c , fmt .Errorf ("run registry : %w" , err )
306296 }
307297
308298 address , err := c .Address (ctx )
0 commit comments