by Matteo Scaramuccia.
Hi Ning,
what is the Moodle image your container is running from?
From the error (localhost:8000), I'm guessing you're using https://github.com/moodlehq/moodle-docker/ .
If confirmed, you can configure both host and port via MOODLE_DOCKER_WEB_HOST and MOODLE_DOCKER_WEB_PORT, respectively.
Just configure them using the IP of the host and the port exposed to the host i.e. what expected by your client.
HTH,
Matteo