-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
Command-serveCommand: serveCommand: serve
Description
problem:
The web socket connection fails if the IP of the website is not equal to the IP used to start mdbook serve which is different when started in a docker container.
setup:
- docker compose with the ports 0.0.0.0:3000 (docker container) => 127.0.0.1:3000 (host) and 3001:3001 mapped.
- page is visible but refresh fails after change
The problem is, that mdbook server has to listen on all external ports in the container:
mdbook server --hostname '0.0.0.0'
The page preview is viewed under http://127.0.0.1:3000
Dockerfile
FROM rust as builder
RUN cargo install mdbook ; \
cargo install mdbook-toc; \
cargo install mdbook-mermaid;
FROM debian:buster-slim
RUN apt-get update && rm -rf /var/lib/apt/lists/*
COPY --from=builder \
/usr/local/cargo/bin/mdbook \
/usr/local/bin/
COPY --from=builder \
/usr/local/cargo/bin/mdbook-toc \
/usr/local/bin/
COPY --from=builder \
/usr/local/cargo/bin/mdbook-mermaid \
/usr/local/bin/
WORKDIR /mdbookdocker-compose.yml
version: "3"
services:
mdbook:
build: ./.docker
volumes:
- "${PWD}:/mdbook"
stdin_open: true
tty: true
ports:
- "3000:3000"
- "3001:3001"
entrypoint: "/usr/local/bin/mdbook"
command:
- serve
- --hostname
- '0.0.0.0'Metadata
Metadata
Assignees
Labels
Command-serveCommand: serveCommand: serve