docker container didn't send any data

running docker build -t <IMAGE_NAME> . then running docker run -p 8080:8080 <IMAGE_NAME> logs to console that it works but does not display the client


FROM rust:1.60.0-slim-buster


COPY . .

RUN rustup target add wasm32-unknown-unknown
RUN cargo install --locked --version 0.15.0 trunk
RUN trunk build --release


CMD ["trunk", "serve", "--release"]


name = "yew-whos-that-pokemon-client"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at

getrandom = { version = "0.2.4", features = ["js"] }
rand = "0.8.5"
reqwest = "0.11.10"
serde_json = "1.0.81"
wasm-bindgen-futures = "0.4.30"
web-sys = "0.3.57"
yew = "0.19.3"

this works perfectly fine locally and i tried with multiple browsers

reference to source code if needed to solve this issue:

any help will be appreciated, thanks


  • server listening at means that the server will only accept connections from, i.e. localhost.

    In a container, localhost is the container itself, so your program won't accept connections from outside the container.

    To get it to do that, you should have your program bind to which will cause it to accept connections from anywhere.

    I'm not a Rust expert, but it seems there's an --address option on trunk serve you can use to tell it what address to bind to. I haven't been able to find an example. Only these release notes where they say they've changed the default bind address from to for security reasons and introduced the --address option in case you need to set another address.

    Update: I tried downloading your project and if I change the CMD statement in the Dockerfile to

    CMD ["trunk", "serve", "--release", "--address", ""]

    it works.