clever-yacht-60730
03/02/2022, 9:15 PMdocker_image
. The image is building successfully, but when I run a container using the image, it is not able to serve requests to the host (made sure that I am forwarding the correct port). I am using docker on WSL2, and have pasted pants' BUILD
file and the dockerfile
I'm using to build the image in the thread. Any ideas on how I can fix this? 🙂clever-yacht-60730
03/02/2022, 9:15 PMFROM python:3.9.10-slim-buster
COPY my-lib/bin-my-lib.pex ./my-lib.pex
RUN PEX_TOOLS=1 ./my-lib.pex venv ./my-lib-venv && rm ./my-lib.pex
CMD "./my-lib-venv/pex"
BUILD file:
python_sources(
name="lib",
sources=["my-lib/**/*.py"],
)
pex_binary(
name="bin-my-lib",
dependencies=[":lib"],
entry_point="<http://my-lib.app:main|my-lib.app:main>",
include_tools=True,
execution_mode="venv",
)
docker_image(
name="docker",
dependencies=[":bin-my-lib"],
)
high-yak-85899
03/02/2022, 9:16 PMRUN
command doing? I haven't seen anything like that in the Pants docs.clever-yacht-60730
03/02/2022, 9:24 PMhundreds-father-404
03/02/2022, 9:25 PMt is not able to serve requests to the host
clever-yacht-60730
03/02/2022, 9:26 PMhigh-yak-85899
03/02/2022, 9:27 PMhigh-yak-85899
03/02/2022, 9:27 PMhigh-yak-85899
03/02/2022, 9:28 PMmade sure that I am forwarding the correct port
high-yak-85899
03/02/2022, 9:29 PMEXPOSE
command in the Dockerfile with the port number, the only way it would work is if you ran it on the host network in which case ports don't need to be explicitly exposed.clever-yacht-60730
03/02/2022, 9:30 PMdocker run -p '8080:8080' <image_name>
to run the containerclever-yacht-60730
03/02/2022, 9:30 PMEXPOSE
thanks 👍high-yak-85899
03/02/2022, 9:31 PMEXPOSE 8080
and I bet you'll see something goodclever-yacht-60730
03/02/2022, 9:44 PMcurl <http://localhost:8080/>
it responds with curl: (52) Empty reply from server
high-yak-85899
03/02/2022, 9:47 PMclever-yacht-60730
03/02/2022, 9:49 PMclever-yacht-60730
03/02/2022, 9:50 PM