0

I have a podman container running on my host with a public IP. If I try to access localhost:80 from container, it should get mapped to host-ip:443.

I tried to do this using port forwarding like this: podman run -it ..... -p host-ip:443:80 since in podman we need to give in host-port:container-port format. But this passes traffic from host to container only, not from container to host. I also tried with --net=host, but it replaced the container's localhost to host's localhost itself.

Even if it works on docker, kindly help me resolve it, since most commands on docker works on podman also.

im_mgn
  • 26
  • 3
  • 1
    I use it with `docker-compose`, the `extra_hosts: - "host.docker.internal:host-gateway"` entry, in the container I use `host.docker.internal:80` - see https://github.com/compose-spec/compose-spec/blob/master/spec.md#extra_hosts. for additional info, it should also be available w/ just docker/podman parameters as well. let me know if that's useful – divadpoc May 02 '23 at 06:25
  • in podman it is `host.containers.internal`. i pinged `host.containers.internal` inside container. but it wasn't reachable. – im_mgn May 02 '23 at 06:49
  • i use a macvlan network for connecting my container with the public IP. maybe that's why i'm unable to connect to the host from my container?? – im_mgn May 02 '23 at 06:51
  • honestly I'm not sure, I only used it w/ `bridged` - never tried w/ another network driver – divadpoc May 02 '23 at 12:15

0 Answers0