【云原生之Docker实战】使用Docker部署flatnotes笔记工具
一、flatnotes介绍
1.1 flatnotes简介
1.2 flatnotes特点
二、本地环境介绍
2.1 本地环境规划
hostname | IP地址 | 操作系统版本 | Docker版本 |
---|---|---|---|
jeven | 192.168.3.166 | centos 7.6 | 20.10.17 |
2.2 本次实践介绍
三、本地环境检查
3.1 检查Docker服务状态
[root@jeven ~]# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2023-08-23 23:41:16 CST; 1 weeks 1 days ago
Docs: https://docs.docker.com
Main PID: 9562 (dockerd)
Tasks: 50
Memory: 1.4G
CGroup: /system.slice/docker.service
3.2 检查Docker版本
检查Docker版本
[root@jeven ~]# docker version
Client: Docker Engine - Community
Version: 20.10.17
API version: 1.41
Go version: go1.17.11
Git commit: 100c701
Built: Mon Jun 6 23:05:12 2022
OS/Arch: linux/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.17
API version: 1.41 (minimum version 1.12)
Go version: go1.17.11
Git commit: a89b842
Built: Mon Jun 6 23:03:33 2022
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.6
GitCommit: 10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1
runc:
Version: 1.1.2
GitCommit: v1.1.2-0-ga916309
docker-init:
Version: 0.19.0
GitCommit: de40ad0
3.3 检查docker compose 版本
检查Docker compose版本,确保2.0以上版本。
[[root@jeven ~]# docker compose version
Docker Compose version v2.19.1
四、下载flatnotes镜像
[root@jeven ~]# docker pull dullage/flatnotes
Using default tag: latest
latest: Pulling from dullage/flatnotes
1d5252f66ea9: Pull complete
eefb43356e06: Pull complete
c26db0eb1f01: Pull complete
300843d99304: Pull complete
daddf7df59b6: Pull complete
fd5b7d323a9e: Pull complete
956d12ab1aba: Pull complete
3a27da5a148e: Pull complete
9bc9c825c797: Pull complete
4f4fb700ef54: Pull complete
2dff9aeca767: Pull complete
745990a309e1: Pull complete
cf33157fe535: Pull complete
1f4f074b255f: Pull complete
042bd107273a: Pull complete
Digest: sha256:666b237abff5a16d781ee7f06ccdadef9e42951de3ec320a071407a9e85666ef
Status: Downloaded newer image for dullage/flatnotes:latest
docker.io/dullage/flatnotes:latest
五、部署flatnotes笔记工具
5.1 创建目录
mkdir -p /data/flatnotes/data && cd /data/flatnotes/
目录授权工作
chmod -R 777 /data/flatnotes/
5.2 使用docker-cli部署
[root@jeven flatnotes]# cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 24 | head -n 1
Nl1rQmfg4gsnJfBfsmkXOo7G
docker run -d
--restart unless-stopped
--name flatnotes
-p "28880:8080"
-v "/data/flatnotes/data:/data"
-e "FLATNOTES_AUTH_TYPE=password"
-e "FLATNOTES_USERNAME=admin"
-e "FLATNOTES_PASSWORD=admin"
-e "FLATNOTES_SECRET_KEY=Nl1rQmfg4gsnJfBfsmkXOo7G"
-e "PORT=8080"
dullage/flatnotes:latest
5.3 编辑docker-compose.yaml文件
version: '3'
services:
flatnotes:
image: dullage/flatnotes:latest
container_name: flatnotes
restart: always
ports:
- 28880:8080
volumes:
- /data/flatnotes/data:/data
environment:
- FLATNOTES_AUTH_TYPE=password
- FLATNOTES_USERNAME=admin
- FLATNOTES_PASSWORD=admin
- FLATNOTES_SECRET_KEY=Nl1rQmfg4gsnJfBfsmkXOo7G
- PORT=8080
5.4 创建flatnotes容器
[root@jeven flatnotes]# docker compose up -d
[+] Running 2/2
⠿ Network flatnotes_default Created 0.1s
⠿ Container flatnotes Started 0.4s
5.5 检查flatnotes容器状态
[root@jeven flatnotes]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
23eebd85b174 dullage/flatnotes:latest "/entrypoint.sh" 13 seconds ago Up 13 seconds 0.0.0.0:28880->8080/tcp, :::28880->8080/tcp flatnotes
5.6 检查flatnotes容器日志
[root@jeven flatnotes]# docker logs flatnotes
Setting up user and group...
Adding group `flatnotes' (GID 1000) ...
Done.
Adding user `flatnotes' ...
Adding new user `flatnotes' (1000) with group `flatnotes' ...
Creating home directory `/home/flatnotes' ...
Copying files from `/etc/skel' ...
Setting file permissions...
WARNING: Breaking changes introduced in version 3.x:
- The port flatnotes uses inside the Docker container has been changed to 8080 (previously 80).
- To accompany the above change, support for the PORT environment variable has been removed.
- The note directory inside the Docker container has moved from /app/data to simply /data.
Starting flatnotes...
2023-09-01 10:22:51 [INFO]: Creating new index
INFO: Started server process [1]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)
六、访问flatnotes
6.1 进入flatnotes登录页
6.2 访问flatnotes首页
七、flatnotes的基本使用
7.1 新建笔记
7.2 编辑笔记内容
7.3 预览笔记内容
7.4 保存笔记内容
保存笔记内容
7.5 查看首页笔记
7.6 查看文件存储
[root@jeven data]# pwd
/data/flatnotes/data
[root@jeven data]# ls -l
total 8
-rw-r--r--. 1 admin admin 5680 Sep 1 18:52 Linux系统之普通用户sudo提权配置.md
原文地址:https://blog.csdn.net/jks212454/article/details/132628349
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.7code.cn/show_4759.html
如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱:suwngjj01@126.com进行投诉反馈,一经查实,立即删除!
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。