Closed
Description
rustc --version
rustc 1.48.0
Rocket version from Cargo lock
name = "rocket"
version = "0.5.0-dev"
source = "git+https://github.com/SergioBenitez/Rocket?branch=master#bcb8b3334b2f4e4f1a213937bcfcbd8599229f63"
Example
Cargo.toml
[package]
authors = ["Adam Friedland"]
edition = "2018"
name = "docker-test"
version = "0.1.0"
[dependencies]
rocket = {git = "https://github.com/SergioBenitez/Rocket", branch = "master"}
Main.rs
#![feature(proc_macro_hygiene, decl_macro)]
#[rocket::get("/")]
fn index() -> &'static str {
"Hello, world!"
}
#[rocket::launch]
fn rocket() -> rocket::Rocket {
rocket::ignite().mount("/", rocket::routes![index])
}
Rocket.toml
[debug]
address = "127.0.0.1"
log_level = "debug"
port = 8000
[release]
address = "0.0.0.0"
log_level = "debug"
port = 8000
Dockerfile
# select bin image builder
FROM rustlang/rust:nightly as builder
# create a new empty project for cache persistence
WORKDIR /app/src
# copy source tree
COPY ./ ./
# build for release
RUN cargo build --release
# pipeline to final image
FROM debian:jessie-slim
COPY --from=builder /app/src/target/release/docker-test ./
CMD ["./docker-test"]
Expected in container
Configured for release.
=> address: 0.0.0.0
=> port: 8000
=> workers: 48
=> log level: debug
=> secret key: [zero]
=> limits: forms = 32KiB
=> cli colors: true
=> keep-alive: 5s
=> tls: disabled
Mounting /:
=> GET / (index)
registering with poller
register Token(0) Readable | Writable
set readiness to (empty)
scheduling an accept
Rocket has launched from http://0.0.0.0:8000
What actually outputs to container
docker logs --tail 1000 -f #####
I can cargo build --release
locally which produces a binary that I can run without a hitch. It's only when I try to run the compiled image within Docker that it produces no output. I've also just tried to hit the endpoint just in case I somehow messed up my Rocket.toml
config but still didn't have any luck. I'm currently using Docker for Windows with the WSL 2 engine enabled.