Skip to content

Instantly share code, notes, and snippets.

@akosdudas
Created March 26, 2021 07:10
Show Gist options
  • Save akosdudas/f0f14a1e6c0c5653f976af9cd79c56ad to your computer and use it in GitHub Desktop.
Save akosdudas/f0f14a1e6c0c5653f976af9cd79c56ad to your computer and use it in GitHub Desktop.
VS Code devcontainer configuration for MkDocs Material website

VS Code devcontainer configuration for MkDocs Material website

What is this

This is a sample configuration for setting up VS Code and Remote Containers to enable editing an MkDocs Material website repository conveniently.

How to use it

Pre-requisites: Docker, Visual Studio Code, Remote Development extension

  1. Start VS Code open the repository inside a container:
    • Run command (Ctrl-Shift-P or F1) Remote-Containers: Open Folder in Container... and browse the repository folder.
    • Or open the repository root folder and follow popup instructions to "Re-open folder in container."
  2. Open a new Terminal and execute command mkdocs serve.
// .devcontainer/devcontainer.json
{
"name": "MkDocs Material editor",
"dockerFile": "Dockerfile",
"workspaceMount": "source=${localWorkspaceFolder},target=/docs,type=bind",
"workspaceFolder": "/docs",
"settings": {
"terminal.integrated.shell.linux": "/bin/sh"
},
"extensions": [
"davidanson.vscode-markdownlint",
// Add further extensions, e.g., spell checker
// "znck.grammarly"
],
"forwardPorts": [
8000
]
}
# .devcontainer/Dockerfile
# Specify version of MkDocs Material
FROM squidfunk/mkdocs-material:7.0.6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment