mkdocs-material: MkDocs 1.1.1 breaks development server in Docker image

Description

When I try to run my Dockerfile to serve the mkdocs site locally, I get an error about the dev-addr

Expected behavior

I expect the mkdocs site to successfully load locally at http://0.0.0.0:8000/

Actual behavior

mkdocs gives this error:

INFO    -  Building documentation... 
ERROR   -  Config value: 'dev_addr'. Error: The MkDocs' server is intended for development purposes only. Therefore, '0.0.0.0' is not a supported IP address. Please use a third party production-ready server instead. 

Aborted with 1 Configuration Errors!

Steps to reproduce the bug

docker run --it -p 8000:8000 image-id

Package versions

  • Python: python 3.6
  • MkDocs: latest version on github (I clone the mkdocs-material in my Dockerfile)

Project configuration

# Project information
site_name: Site Name
site_description: Site Description
site_author: Author
site_url: ""

# Repository
repo_name: test/test
repo_url: https://github.com/test/test
edit_uri: ""

# Copyright
copyright: "Copyright"

# Configuration
theme:
  name: null
  custom_dir: material

  # 404 page
  static_templates:
    - 404.html

  # Don't include MkDocs' JavaScript
  include_search_page: false
  search_index_only: true

  # Default values, taken from mkdocs_theme.yml
  language: en
  features:
    - tabs
    - instant
  palette:
    primary: blue
    accent: blue
  font:
    text: Roboto
    code: Roboto Mono
  icon:
    logo: logo
  favicon: assets/images/favicon.png

# Customization
extra:
  social:
    - icon: logo
      link: https://www.test.com/

# Extensions
markdown_extensions:
  - markdown.extensions.admonition
  - markdown.extensions.attr_list
  - markdown.extensions.codehilite:
      guess_lang: false
  - markdown.extensions.def_list
  - markdown.extensions.footnotes
  - markdown.extensions.meta
  - markdown.extensions.toc:
      permalink: true
  - pymdownx.arithmatex
  - pymdownx.betterem:
      smart_enable: all
  - pymdownx.caret
  - pymdownx.critic
  - pymdownx.details
  - pymdownx.emoji:
      emoji_index: !!python/name:materialx.emoji.twemoji
      emoji_generator: !!python/name:materialx.emoji.to_svg
        # - pymdownx.highlight:
      #     linenums_style: pymdownx-inline
  - pymdownx.inlinehilite
  - pymdownx.keys
  - pymdownx.magiclink:
      repo_url_shorthand: true
      user: squidfunk
      repo: mkdocs-material
  - pymdownx.mark
  - pymdownx.smartsymbols
  - pymdownx.snippets:
      check_paths: true
  - pymdownx.superfences
  - pymdownx.tabbed
  - pymdownx.tasklist:
      custom_checkbox: true
  - pymdownx.tilde

#yamllint disable rule:line-length
nav:
     - Introduction:
          - test: test.md

System information

  • OS: Mac
  • Browser: Google Chrome

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 17 (10 by maintainers)

Commits related to this issue

Most upvoted comments

We’re running in strict mode, meaning it’s an error. May want to call out that it’s no longer possible to use the flag in the latest version.

On Fri, Jun 26, 2020, 9:42 AM Martin Donath notifications@github.com wrote:

It’s only a warning. It was the deliberate decision of the MkDocs maintainers to leave it like that. Nothing we can do about, unfortunately.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/squidfunk/mkdocs-material/issues/1691#issuecomment-650216076, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGRMZDA4M7HRAVBDEZIC4TRYSXU3ANCNFSM4M73XLZQ .

Yes, strict will not work anymore since the change was introduced. Unfortunately, there’s nothing we can do about it, since Material for MkDocs is only a theme and this is something that would need to be changed in MkDocs. The only thing you can do is vouch in the linked issue for returning back to the original behavior.

EDIT: the fact that dev_addr is not respected, is because the Docker image will not work without setting the address to 0.0.0.0, as the service would not be visible outside Docker. This is done by Material’s official Docker image:

https://github.com/squidfunk/mkdocs-material/blob/a3c0e46d123e78d9da0c3986e26b5ff188f8fd9d/Dockerfile#L63

@squidfunk Just want to say thanks so much for your advocacy on the mkdocs issue thread. It was nice to see a rational and compassionate approach. Looking forward to finding a solution as we also run in strict mode.

Yes, pin the dependency to 1.1:

mkdocs==1.1

That’s an upstream issue. It seems that MkDocs 1.1.1 forbids the dev server to run on 0.0.0.0, see https://github.com/mkdocs/mkdocs/issues/2108

Let’s hope they revert this behavior. Otherwise it’ll render any usage of the Docker image useless.