Receiving http response inside a Docker container

I am running a process, process A, inside a Docker container that sends an HTTP reqeust to a process, process B, running natively on the host. Process B receives the request and after processing sends a response which process A does not receive. I believe this could be because I am not exposing the port on which the reply is sent. My understanding is that, this source port is randomly chosen and I am not sure how I can expose this port. Is there a way to overcome this issue?

  • How to disable Docker container to restart for `gcloud preview app run`
  • Docker for windows - File shares
  • docker + django : loop + break using forms
  • What alternatives are there for Docker on Solaris 11.3?
  • Trying to create an automated docker build
  • Docker container with ASP.NET Core libraries
  • Access docker within container on jenkins slave
  • PyCharm add remote Python interpreter inside the Docker
  • How to run a library in docker - confusion
  • How do I keep IPs in a dockerized Consul cluster on a single node after restart
  • Volume mount haproxy socket from HAProxy docker container
  • Parse logs in fluentd
  • One Solution collect form web for “Receiving http response inside a Docker container”

    My understanding is that, this source port is randomly chosen and I am not sure how I can expose this port

    It is only if your container runs with the -P option.
    If you run with -p hostp_port:container_port option (with container_port being a port EXPOSE‘d in the Dockerfile of the image from which the container is running), that will work.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.