Run MkDocs - Read the Docs Alternative - in Docker
#MkDocs #Containers #Docker
Full steps can be found at https://i12bretro.github.io/tutorials/0986.html
--------------------------------------------------------------------
What is MkDocs?
--------------------------------------------------------------------
MkDocs is a fast, simple and downright gorgeous static site generator that's geared towards building project documentation. Documentation source files are written in Markdown, and configured with a single YAML configuration file. It is designed to be easy to use and can be extended with third-party themes, plugins, and Markdown extensions. - https://github.com/mkdocs/mkdocs
--------------------------------------------------------------------
Installing Docker
--------------------------------------------------------------------
01. Log into the Linux based device
02. Run the following commands in the terminal
install prerequisites
sudo apt install apt-transport-https ca-certificates git curl software-properties-common gnupg-agent -y
add docker gpg key
curl -fsSL https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release)/gpg | sudo apt-key add -
add docker software repository
sudo add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release) $(lsb_release -cs) stable"
install docker
sudo apt install docker-ce docker-compose containerd.io -y
enable and start docker service
sudo systemctl enable docker && sudo systemctl start docker
add the current user to the docker group
sudo usermod -aG docker $USER
reauthenticate for the new group membership to take effect
su - $USER
--------------------------------------------------------------------
Running MkDocs
--------------------------------------------------------------------
01. Now that Docker is installed, run the following commands to setup the MkDocs Docker container and run it
create working directory
mkdir ~/docker/mkdocs
set owner of working directories
sudo chown "$USER":"$USER" ~/docker -R
allow the container to write to working directories
sudo chmod a+rwx -R ~/docker/mkdocs
run mkdocs container
docker run -d --name=mkdocs -p 8000:8000 -v ~/docker/mkdocs/:/mkdocs --restart=unless-stopped polinux/mkdocs
02. Open a web browser and navigate to http://DNSorIP:8000
03. Welcome to MkDocs running in Docker
--------------------------------------------------------------------
Read the Docs Theme
--------------------------------------------------------------------
01. Back in the terminal, continue with the following commands
stop the container
docker stop mkdocs
edit the mkdocs configuration file
sudo nano ~/docker/mkdocs/mkdocs.yml
02. Add the following line to mkdocs.yml
theme: readthedocs
03. Press CTRL+O, Enter, CTRL+X to write the changes
04. Run the following command to see the change
restart the container
docker start mkdocs
05. Back in the web browser, refresh the mkdocs page
Source: https://www.mkdocs.org/getting-started/
Documentation: https://hub.docker.com/r/polinux/mkdocs
Connect with me and others ###
★ Discord: https://discord.com/invite/EzenvmSHW8
★ Reddit: https://reddit.com/r/i12bretro
★ Twitter: https://twitter.com/i12bretro