Closed larrycai closed 1 year ago
Hi @larrycai ,
Sorry for the late reply. The container name looks correct to me, and I had put my container status in readme. There are some differences like underline or dash, but I think that just because podman compose and docker compose have different patterns to generate the container name dynamically.
Back to your main question about why the containers can't communicate with each other even though you already modified the host inmain.py
when using podman compose. In docker compose, each container can communicate with each other with service name
(the key in compose file's services section) because they are in the same network. So there is no need to modify the host name, just keep it with the service name.
Since I am not using podman, I can't reproduce your issue. But I think it may be related to the network type you are using for podman, there are some discussion on https://github.com/containers/podman-compose/issues/541#issuecomment-1221417067 and https://github.com/containers/podman-compose/issues/455#issue-1175346762. You can try to switch your podman network from cri
to netavark
, then your container may communicate with each other with service name.
There is a post Podman 4.0's new network stack: What you need to know from RedHat may help you too.
Yes, u r correct. I checked the /etc/hosts
, it actually goes via DNS.
thank
Don't know what's the wrong with my env? I use
podman-compose
@ Mac, but it shall be the same.forget how to fix it, I got the container name is
fastapi-jaeger_app-a_1
with extra prefixfastapi-jaeger
and suffix_1
.I have to change in all related areas to make it work as expected
main.py
likeTARGET_ONE_HOST = os.environ.get("TARGET_ONE_HOST", "fastapi-jaeger_app-b_1")
// fromapp_b
docker-compose.yaml
for namingetc
But I think it shall not work like this, what's wrong with my env? I use
podman-compose
@ Mac, but it shall be the sameCan you paste your console out in the readme, I got it like below.