添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
傻傻的键盘  ·  Running "mkdocs ...·  2 天前    · 
想旅行的熊猫  ·  asp.net core - ...·  1 年前    · 
爱运动的大象  ·  [Day 21] 媽! Keras 和 ...·  2 年前    · 

Running "mkdocs serve" through Docker results in "Connection reset by peer" #7197

@marc-guenther

Description

Context

This is on Mac, using Docker 26.0.0, and mkdocs 1.6.0, in a completely fresh project:

$ docker --version             
Docker version 26.0.0, build 2ae903e
$ docker run --rm  squidfunk/mkdocs-material --version
mkdocs, version 1.6.0 from /usr/local/lib/python3.11/site-packages/mkdocs (Python 3.11)
$ docker run --rm -v .:/docs squidfunk/mkdocs-material new empty-project
$ cd




    
 empty-project

Bug description

When I run the "serve" command:

$ docker run --rm -v .:/docs -p 8000:8000 squidfunk/mkdocs-material serve
INFO    -  Building documentation...
INFO    -  Cleaning site directory
INFO    -  Documentation built in 0.11 seconds
INFO    -  [12:44:48] Watching paths for changes: 'docs', 'mkdocs.yml'
INFO    -  [12:44:48] Serving on http://127.0.0.1:8000/

a subsequent curl does not work:

$ curl http://localhost:8000
curl: (56) Recv failure: Connection reset by peer

When i run it without the serve argument:

$ docker run --rm -v .:/docs -p 8000:8000 squidfunk/mkdocs-material
WARNING -  Config value 'dev_addr': The use of the IP address '0.0.0.0' suggests a production environment or the use of a proxy to connect to the MkDocs server. However, the MkDocs' server is intended for local development purposes only. Please use a third party production-ready server instead.
INFO    -  Building documentation...
INFO    -  Cleaning site directory
INFO    -  Documentation built in 0.11 seconds
INFO    -  [12:45:47] Watching paths for changes: 'docs', 'mkdocs.yml'
INFO    -  [12:45:47] Serving on http://0.0.0.0:8000/

everything is fine.

Please note the different IP address. It fails, when it binds to 127.0.0.1, but works, when it binds to 0.0.0.0:

$ docker run --rm -v .:/docs -p 8000:8000 squidfunk/mkdocs-material serve -a 0.0.0.0:8000

behaves exactly as leaving out the "serve" argument.

Related links

  • Reporting a bug
  • Issue search for "docker connection"
  • Reproduction

    I have no idea what to put here, as this is an issue running through Docker, which happens with every project.
    empty.zip

    Steps to reproduce

    Browser

    No response

    Before submitting

  • I have read and followed the bug reporting guidelines.
  • I have attached links to the documentation, and possibly related issues and discussions.
  • I assure that I have removed all customizations before submitting this bug report.
  • I have attached a .zip file with a minimal reproduction using the built-in info plugin.
  •