-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed as not planned
Closed as not planned
Copy link
Description
Module
Core
Testcontainers version
1.20.4
Using the latest Testcontainers version?
Yes
Host OS
MacOS
Host Arch
ARM
Docker version
27.4.0What happened?
I want to have different docker private registries setting for my docker compose file. Therefore I am using the approaches that uses placeholder ${DOCKER_REGISTRY_URL} and then supply the value dynamically in the code. The problem is that I got the no basic auth error when trying pull the image from the private registry when running test. I suppose it should be working without problem.
p.s:
- I have already docker login in terminal so that I can pull the image from the terminal
- Thanks for JapuDCret reply in How to login to private DockerHub registry in runtime? #968 (comment). If the url is hard-coded in the docker-compose file, the image can be pulled and test can be run without problem while on the other hands dynamically url is not working ()
The way I supply in the code (Kotlin)
val redisContainer = DockerComposeContainer(redisConfigFile)
.withExposedService(
serviceName,
servicePort,
Wait.forListeningPort().withStartupTimeout(Duration.ofMillis(timeout))
)
.withEnv("DOCKER_REGISTRY_URL", dockerRegistry)
Example docker compose file
services:
redis:
image: ${DOCKER_REGISTRY_URL}/redis:alpine3.20
ports:
- 6379
command: >
redis-server
--requirepass password
networks:
- test-my-redis-network
networks:
test-my-redis-network:
Relevant log output
no basic auth credentialsAdditional Information
No response