I run tests in a docker container. As a part of this process, I need to spin up another docker container. I use testscontainers-go
to do it. The docker container starts just fine but I can't talk to it.
req := testcontainers.ContainerRequest{
Image: "my-image",
ExposedPorts: []string{"9000:9000"},
SkipReaper: true,
WaitingFor: wait.
ForLog("Server started").
WithPollInterval(time.Second * 10).
WithStartupTimeout(time.Minute * 10),
RegistryCred: getRegistryCred(),
Hostname: "server",
}
From the test I try to access the new container using http://server:9000
but it is not there. Is there any way to assign a hostname to the child container?