web123456

Docker Project Practice] Deploying a Lightweight Markdown Text Editor with Docker

【【DockerProject Practice] Deploying a Lightweight Markdown Text Editor with Docker

  • I. Introduction to the project
    • 1.1 Project description
    • 1.2 Methods of use
  • II. Introduction to this practice
    • 2.1 Local environmental planning
    • 2.2 Introduction to this exercise
  • III. Local environment checks
    • 3.1 Installing the Docker Environment
    • 3.2 Checking Docker Service Status
    • 3.3 Checking the Docker Version
    • 3.4 Checking the docker compose version
  • IV. Pulling container mirrors
  • V. Deployment projects
    • 5.1 Editing documents
    • 5.2 Creating containers
    • 5.3 Viewing Container Status
    • 5.4 Disabling the Firewall
  • VI. Visiting projects
    • 6.1 Accessing the initial page
    • 6.2 Editing articles
    • 6.3 Viewing Help Information
    • 6.4 Switching display modes
    • 6.5 Save text
  • VII. Summary

I. Introduction to the project

1.1 Project description

The tool is a lightweight, non-intrusive text editor that runs in your browser and supports Markdown andLaTeXGrammar. This tool provides a clean and concise writing environment that helps users focus on their creative work, and is especially suited for writers who need to compose articles that contain mathematical formulas or scientific notation. Whether you are writing a blog, an academic paper or a novel, it provides an efficient and convenient online editing experience.

1.2 Methods of use

(computer) shortcut key Functional Description
CTRL + D Switching display modes
CTRL + P Print or export to PDF
CTRL + S Save source code as .MD file
CTRL+SHIFT+H Show Help
? (Icon in the lower left corner) Also used for displaying help

II. Introduction to this practice

2.1 Local environmental planning

This practice is a personal test environment, the operating system version is centos7.6.

hostname IP address Operating system version Docker version
ubuntu-001 192.168.3.251 Ubuntu 22.04.1 LTS 24.0.7

2.2 Introduction to this exercise

1. This practice deployment environment for personal testing environment, production environment, please be careful;
2. Lightweight Markdown text editor in a Docker environment.

III. Local environment checks

3.1 Installing the Docker Environment

This practice requires the Docker environment to be installed in advance. If it is not installed, you can use the following one-click install script to deploy the Docker environment.

curl -fsSL  -o 
sh  --mirror Aliyun
  • 1
  • 2
  • Docker image acceleration configuration
sudo tee /etc/docker/ <<EOF
{
    "registry-mirrors": [
        "",
        "",
        "",
        "",
        "",
        "https://docker."
    ]
}
EOF

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
systemctl daemon-reload  && systemctl restart docker
  • 1
  • Enable route forwarding
echo "net.ipv4.ip_forward=1" >>  /etc/
systemctl restart network
sysctl net.ipv4.ip_forward
  • 1
  • 2
  • 3
  • In the /etc// file, write the following:
vim /etc//
  • 1
echo 1 > /proc/sys/net/bridge/bridge-nf-call-iptables
echo 1 > /proc/sys/net/bridge/bridge-nf-call-ip6tables
  • 1
  • 2
chmod +x /etc//
  • 1

3.2 Checking Docker Service Status

Check that the Docker service is running properly and make sure that Docker is running properly.

root@ubuntu-001:~# systemctl status docker
●  - Docker Application Container Engine
     Loaded: loaded (/lib/systemd/system/; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2024-07-29 08:15:30 UTC; 2 days ago
TriggeredBy: ● 
       Docs: 
   Main PID: 325094 (dockerd)
      Tasks: 101
     Memory: 391.3M
        CPU: 1min 16.015s
     CGroup: //
             ├─325094 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12

3.3 Checking the Docker Version

Check the Docker version, currently using Docker version is24.0.7

root@ubuntu-001:~#  docker -v
Docker version 24.0.7, build 24.0.7-0ubuntu2~22.04.1
  • 1
  • 2

3.4 Checking the dockercompose releases

Check the Docker compose version and make sure it is 2.0 or higher.

root@ubuntu-001:~# docker compose version
Docker Compose version v2.19.1
  • 1
  • 2

IV. Pulling container mirrors

Pulls the container image for the item:/jeson/markdown_note:latest

root@ubuntu-001:~# docker pull /jeson/markdown_note:latest
latest: Pulling from jeson/markdown_note
Digest: sha256:763f28a197203e7f71965f2cee026fd855d49ffe08dc79f5ce8ff51140f908d9
Status: Image is up to date for /jeson/markdown_note:latest
/jeson/markdown_note:latest
  • 1
  • 2
  • 3
  • 4
  • 5

V. Deployment projects

5.1 Editing documents

You can use docker-cli fast deployment, you can also use docker compose way to deploy, this practice use docker compose way to deploy.

  • Example docker-cli deployment:
docker run -d --name markdown_note --restart always -p 6223:80 /jeson/markdown_note:latest
  • 1

Edit the deployment file as follows:

vim 
  • 1
version: '3'
services:
  tower_game:
    container_name: markdown_note
    image: -/jeson/markdown_note:latest
    restart: always
    ports:
      - 6223:80

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

5.2 Creating containers

fulfillmentdocker compose up -dcommand to create the container. Note that you need to ensure that the6223Not occupied to prevent port conflicts.

root@ubuntu-001:/data/markdown_note# docker compose up -d
[+] Running 2/2
 ✔ Network markdown_note_default  Created                                                                                                                0.1s
 ✔ Container markdown_note        Started                                                                                                                0.4s
  • 1
  • 2
  • 3
  • 4

5.3 Viewing Container Status

Check the status of the container to ensure that it is starting properly.

root@ubuntu-001:/data/markdown_note# docker compose ps
NAME                IMAGE                                                          COMMAND                  SERVICE             CREATED             STATUS          PORTS
markdown_note       /jeson/markdown_note:latest   "/usr/sbin/httpd -D …"   tower_game          15 seconds ago      Up 14 seconds       0.0.0.0:6223->80/tcp, :::6223->80/tcp
  • 1
  • 2
  • 3

5.4 Disabling the Firewall

On ubuntu systems, turn off the firewall.

root@ubuntu-001:~/tower_game# ufw disable
Firewall is automatically disabled at system startup
root@ubuntu-001:~/tower_game# ufw status
Status: Inactive
  • 1
  • 2
  • 3
  • 4

VI. Visiting projects

6.1 Accessing the initial page

Visit the address: http://192.168.3.251:6223 and replace the IP with your own server IP address to enter into the initial page of the project. If you can't access it, check whether the server firewall is set, whether the security group port of the cloud server is released, etc.

在这里插入图片描述

6.2 Editing articles

Edit the content of the article using markdown syntax within the editor on the left, and preview the results on the right.

在这里插入图片描述

6.3 Viewing Help Information

Icon in the lower right corner of the page? , which can be used to display help information.

在这里插入图片描述

6.4 Switching display modes

  • utilizationCTRL + D : Switching display modes

在这里插入图片描述

6.5 Save text

  • utilizationCTRL + P Print or export to PDF

在这里插入图片描述

  • utilizationCTRL + S : Save the source code as a .MD file .

在这里插入图片描述

VII. Summary

With a lightweight design that works seamlessly in the browser, the "Writing" editor creates an ideal space for users to focus on their work, away from distractions. By combining Markdown and LaTeX support, it not only simplifies the complexity of text formatting, but also makes it easy to write content involving mathematical formulas and scientific notation, greatly improving the editing efficiency of academic research, scientific and technical writing, and all kinds of professional documents. Whether you are a professional academic, a blogger with a passion for technical writing, or a literary creator seeking to capture inspiration, Writing provides an efficient and convenient online editing experience, making it the ideal companion for them to keep writing.