-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
Description
Module
Core
Testcontainers version
1.19.1
Using the latest Testcontainers version?
Yes
Host OS
MacOS
Host Arch
ARM
Docker version
Docker version 24.0.6, build ed223bcWhat happened?
When using a Docker Compose image with a NGinx container, the image fails to start. Restarting the Docker engine will work once. Removing the NGinx service makes everything work fine.
version: '3'
postgrest-db:
image: postgres:16-alpine
ports:
- "5432:5432"
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
- DB_SCHEMA=${DB_SCHEMA}
volumes:
- "./initdb:/docker-entrypoint-initdb.d"
networks:
- postgrest-backend
restart: always
postgrest:
image: postgrest/postgrest:latest
ports:
- "3000:3000"
# https://postgrest.org/en/latest/configuration.html#environment-variables
environment:
- PGRST_DB_URI=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgrest-db:5432/${POSTGRES_DB}
- PGRST_DB_SCHEMA=${DB_SCHEMA}
- PGRST_DB_ANON_ROLE=${DB_ANON_ROLE}
networks:
- postgrest-backend
restart: always
nginx:
image: nginx:alpine
restart: always
tty: true
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf
ports:
- "80:80"
- "443:443"
networks:
- postgrest-backend
networks:
postgrest-backend:
driver: bridgeThe java snippet is
@Testcontainers
class MainKtTest {
@Container
var environment: DockerComposeContainer<*> =
DockerComposeContainer(File("src/test/resources/docker-compose.yml"))
.withExposedService("postgrest-db", 5432)
.withExposedService("postgrest", 3000)
.withExposedService("nginx", 80)
.waitingFor("nginx", Wait.forHttp("/").forStatusCode(200).withStartupTimeout(Duration.ofSeconds(15)))
...
}Relevant log output
org.testcontainers.containers.ContainerLaunchException: Container startup failed for image alpine/socat:1.7.4.3-r0
at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:359)
at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:334)
at org.testcontainers.containers.ComposeDelegate.startAmbassadorContainer(ComposeDelegate.java:276)
at org.testcontainers.containers.DockerComposeContainer.start(DockerComposeContainer.java:145)
at org.testcontainers.junit.jupiter.TestcontainersExtension$StoreAdapter.start(TestcontainersExtension.java:280)
...
Caused by: org.testcontainers.containers.ContainerLaunchException: Aborting attempt to link to container 3gcmphvfu3va_nginx_1 as it is not running
at org.testcontainers.containers.GenericContainer.applyConfiguration(GenericContainer.java:850)
at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:389)
... 89 more
Retry limit hit with exception
org.rnorth.ducttape.RetryCountExceededException: Retry limit hit with exception
at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:88)
at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:344)Additional Information
Using docker compose straight starts all services without issues, consistently. Tried changing the pinned version of nginx, with no success either.