You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Question: How to set env for DockerImage or ServerContainer #670
Basically my app is using dotenv, to get env for redis and postgres.
Problem is I have not found way to send current os.environ to DockerImage.
I was thinking to hardcoded in additional Dockerfile.hr2ws.for_testcontiner file, but that will also not work because port is dynamically provided by testcontainer framework, also do not think that is correct way to do it.
I did look open PR an issues but was not able to find anything, only found similar for testcontainers-rs
Do not know is this related to OSX or Docker Desktop:
When I wanted to access redis container started by testcontiners framework from my own FastAPI container I needed to use host.docker.internal instead of localhost.
But when I need to access same redis from pytest test file then localhost was working but not host.docker.internal.
Just as info, pretty sure somebody else will have same situation.
Activity
sasa-buklijas commentedon Aug 9, 2024
Solution that have found on testcontainers Slack is to use
.with_env()onServerContainer.Will leave issue open for few days, if there are some alternative solution, pleas add them.
sasa-buklijas commentedon Aug 9, 2024
Do not know is this related to OSX or Docker Desktop:
When I wanted to access redis container started by testcontiners framework from my own FastAPI container I needed to use
host.docker.internalinstead oflocalhost.But when I need to access same redis from pytest test file then
localhostwas working but nothost.docker.internal.Just as info, pretty sure somebody else will have same situation.