-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Description
Let's say I clone this repo:
git clone https://github.com/robertbasic/robertbasic.com-hugo.git
Then start up a docker container on Hugo 0.16:
docker run -ti --rm --name "my-hugo" \
-p 80:80 -v $(pwd)/robertbasic.com-hugo:/src jojomi/hugo \
hugo server --watch=true --source="/src" --bind=0.0.0.0 --port=80 --baseURL="/"
Where I have watch on and I'm listening on port 80. When you load the site, you get:
WebSocket connection to 'ws://192.168.51.1:35729/livereload' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
Which is clearly trying to connect to the hugo server on the wrong port. If you pop the port number up one value:
docker run -ti --rm --name "my-hugo" \
-p 81:81 -v $(pwd)/robertbasic.com-hugo:/src jojomi/hugo \
hugo server --watch=true --source="/src" --bind=0.0.0.0 --port=81 --baseURL="/"
It works as expected (from chrome console):
Request URL:ws://192.168.51.1:81/livereload
Request Method:GET
Status Code:101 Switching Protocols
Originally discussed and discovered here: https://discuss.gohugo.io/t/live-reload-unconnectable-in-docker-container/3457/4