(云原生之使用Docker部署Dokuwiki个人笔记工具)

一、Dokuwiki介绍

Dokuwiki 是一种易于使用且用途广泛的开源Wiki软件,且它不需要数据库。它以其清晰易读的语法受到用户的喜爱。易于维护、备份和集成使其成为管理员的最爱。

二、查看docker状态

[root@docker ~]# 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 Thu 2022-10-27 13:58:22 CST; 2h 38min ago
     Docs: https://docs.docker.com
 Main PID: 8223 (dockerd)
    Tasks: 39
   Memory: 132.3M
   CGroup: /system.slice/docker.service
           ├─8223 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
           ├─8822 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 3000 -container-ip 172.25.0.2 -container-port 3000
           ├─8824 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 89 -container-ip 172.17.0.2 -container-port 80
           ├─8835 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 3000 -container-ip 172.25.0.2 -container-port 3000
           └─8841 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 89 -container-ip 172.17.0.2 -container-port 80

Oct 27 13:57:54 docker dockerd[8223]: time="2022-10-27T13:57:54.455109491+08:00" level=info msg="Loading containers: start."
Oct 27 13:57:55 docker dockerd[8223]: time="2022-10-27T13:57:55.181714757+08:00" level=info msg="Default bridge (docker0) is assigned w...address"
Oct 27 13:58:21 docker dockerd[8223]: time="2022-10-27T13:58:21.615780846+08:00" level=info msg="Loading containers: done."
Oct 27 13:58:21 docker dockerd[8223]: time="2022-10-27T13:58:21.947341520+08:00" level=info msg="Docker daemon" commit=e42327a graphdri...20.10.18
Oct 27 13:58:21 docker dockerd[8223]: time="2022-10-27T13:58:21.947426129+08:00" level=info msg="Daemon has completed initialization"
Oct 27 13:58:22 docker dockerd[8223]: time="2022-10-27T13:58:22.506093152+08:00" level=info msg="API listen on /var/run/docker.sock"
Oct 27 13:58:22 docker systemd[1]: Started Docker Application Container Engine.
Oct 27 14:01:32 docker dockerd[8223]: time="2022-10-27T14:01:32.785020262+08:00" level=warning msg="Error getting v2 registry: Get \"ht...eaders)"
Oct 27 14:01:32 docker dockerd[8223]: time="2022-10-27T14:01:32.785047262+08:00" level=info msg="Attempting next endpoint for pull afte...eaders)"
Oct 27 14:01:32 docker dockerd[8223]: time="2022-10-27T14:01:32.833445154+08:00" level=error msg="Handler for POST /v1.41/images/create...eaders)"
Hint: Some lines were ellipsized, use -l to show in full.

三、下载Dokuwiki镜像

[root@docker dokuwiki]# docker pull ghcr.io/linuxserver/dokuwiki
Using default tag: latest
latest: Pulling from linuxserver/dokuwiki
66ce20e6638e: Already exists 
99bc27d47160: Already exists 
f83b8e85c025: Already exists 
bf5c69bc329a: Pull complete 
67182e6106b7: Pull complete 
efef3dca657b: Pull complete 
5718dfa1cd84: Pull complete 
Digest: sha256:42c695dd84b236ca30214904cffcac620a5b2ba4a1ef958245e423c16c9bff7b
Status: Downloaded newer image for ghcr.io/linuxserver/dokuwiki:latest
ghcr.io/linuxserver/dokuwiki:latest


四、安装Dokuwiki

1.创建数据目录

 mkdir -p /data/dokuwiki  && chmod -R 777  /data/dokuwiki 

2.创建Dokuwiki容器

docker run -d \
  --name=dokuwiki \
  -e PUID=1000 \
  -e PGID=1000 \
  -e TZ=Asia/Shanghai \
  -p 8741:80 \
  -p 443:443 `#optional` \
  -v /data/dokuwiki/config:/config \
  --restart unless-stopped \
  ghcr.io/linuxserver/dokuwiki:latest

image.png

3.查看Dokuwiki容器状态

[root@docker dokuwiki]# docker ps
CONTAINER ID   IMAGE                                       COMMAND                  CREATED          STATUS          PORTS                                                                          NAMES
036ae9218c38   ghcr.io/linuxserver/dokuwiki:latest         "/init"                  45 seconds ago   Up 41 seconds   0.0.0.0:443->443/tcp, :::443->443/tcp, 0.0.0.0:8741->80/tcp, :::8741->80/tcp   dokuwiki


五、Dokuwiki初始化工作

1.初始化Dokuwiki

首次启动容器后,先访问 http://ip:port/install.php 进行配置,完成之后重启容器。

2.查看容器日志

[root@docker dokuwiki]# docker restart dokuwiki 
dokuwiki
[root@docker dokuwiki]# docker logs bbe
[custom-init] No custom services found, skipping...
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service 00-legacy: starting
s6-rc: info: service 00-legacy successfully started
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
cont-init: info: running /etc/cont-init.d/01-envfile
cont-init: info: /etc/cont-init.d/01-envfile exited 0
cont-init: info: running /etc/cont-init.d/01-migrations
[migrations] started
[migrations] 01-nginx-site-confs-default: executing...
[migrations] 01-nginx-site-confs-default: succeeded
[migrations] 02-default-location: executing...
grep: /config/nginx/site-confs/default.conf: No such file or directory
[migrations] 02-default-location: succeeded
[migrations] done
cont-init: info: /etc/cont-init.d/01-migrations exited 0
cont-init: info: running /etc/cont-init.d/10-adduser

-------------------------------------
          _         ()
         | |  ___   _    __
         | | / __| | |  /  \
         | | \__ \ | | | () |
         |_| |___/ |_|  \__/


Brought to you by linuxserver.io
-------------------------------------

To support LSIO projects visit:
https://www.linuxserver.io/donate/
-------------------------------------
GID/UID
-------------------------------------

User uid:    1000
User gid:    1000
-------------------------------------

cont-init: info: /etc/cont-init.d/10-adduser exited 0
cont-init: info: running /etc/cont-init.d/11-folders
cont-init: info: /etc/cont-init.d/11-folders exited 0
cont-init: info: running /etc/cont-init.d/12-samples
cont-init: info: /etc/cont-init.d/12-samples exited 0
cont-init: info: running /etc/cont-init.d/13-nginx
Setting resolver to  223.5.5.5 192.168.3.254
Setting worker_processes to 2
cont-init: info: /etc/cont-init.d/13-nginx exited 0
cont-init: info: running /etc/cont-init.d/14-php
cont-init: info: /etc/cont-init.d/14-php exited 0
cont-init: info: running /etc/cont-init.d/15-keygen
generating self-signed keys in /config/keys, you can replace these with your own keys if required
Generating a RSA private key
................+++++
.......................+++++
writing new private key to '/config/keys/cert.key'
-----
cont-init: info: /etc/cont-init.d/15-keygen exited 0
cont-init: info: running /etc/cont-init.d/20-permissions
cont-init: info: /etc/cont-init.d/20-permissions exited 0
cont-init: info: running /etc/cont-init.d/50-config
Go to http://IP-ADDRESS:PORT/install.php to configure your install then restart your container when finished to remove install.php
[cont-init.d] Setting permissions this may take some time
cont-init: info: /etc/cont-init.d/50-config exited 0
cont-init: info: running /etc/cont-init.d/85-version-checks
cont-init: info: /etc/cont-init.d/85-version-checks exited 0
cont-init: info: running /etc/cont-init.d/99-custom-files
[custom-init] No custom files found, skipping...
cont-init: info: /etc/cont-init.d/99-custom-files exited 0
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service init-mods: starting
s6-rc: info: service init-mods successfully started
s6-rc: info: service init-mods-package-install: starting
s6-rc: info: service init-mods-package-install successfully started
s6-rc: info: service init-mods-end: starting
s6-rc: info: service init-mods-end successfully started
s6-rc: info: service init-services: starting
s6-rc: info: service init-services successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun cron (no readiness notification)
services-up: info: copying legacy longrun nginx (no readiness notification)
services-up: info: copying legacy longrun php-fpm (no readiness notification)
s6-rc: info: service legacy-services successfully started
s6-rc: info: service 99-ci-service-check: starting
[ls.io-init] done.
s6-rc: info: service 99-ci-service-check successfully started
s6-rc: info: service 99-ci-service-check: stopping
s6-rc: info: service 99-ci-service-check successfully stopped
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service init-services: stopping
s6-rc: info: service 00-legacy: stopping
s6-rc: info: service init-services successfully stopped
s6-rc: info: service init-mods-end: stopping
s6-rc: info: service 00-legacy successfully stopped
s6-rc: info: service init-mods-end successfully stopped
s6-rc: info: service init-mods-package-install: stopping
s6-rc: info: service init-mods-package-install successfully stopped
s6-rc: info: service init-mods: stopping
s6-rc: info: service init-mods successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped
[custom-init] No custom services found, skipping...
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service 00-legacy: starting
s6-rc: info: service 00-legacy successfully started
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
cont-init: info: running /etc/cont-init.d/01-envfile
cont-init: info: /etc/cont-init.d/01-envfile exited 0
cont-init: info: running /etc/cont-init.d/01-migrations
[migrations] started
[migrations] 01-nginx-site-confs-default: skipped
[migrations] 02-default-location: skipped
[migrations] done
cont-init: info: /etc/cont-init.d/01-migrations exited 0
cont-init: info: running /etc/cont-init.d/10-adduser
usermod: no changes

-------------------------------------
          _         ()
         | |  ___   _    __
         | | / __| | |  /  \
         | | \__ \ | | | () |
         |_| |___/ |_|  \__/


Brought to you by linuxserver.io
-------------------------------------

To support LSIO projects visit:
https://www.linuxserver.io/donate/
-------------------------------------
GID/UID
-------------------------------------

User uid:    1000
User gid:    1000
-------------------------------------

cont-init: info: /etc/cont-init.d/10-adduser exited 0
cont-init: info: running /etc/cont-init.d/11-folders
cont-init: info: /etc/cont-init.d/11-folders exited 0
cont-init: info: running /etc/cont-init.d/12-samples
cont-init: info: /etc/cont-init.d/12-samples exited 0
cont-init: info: running /etc/cont-init.d/13-nginx
cont-init: info: /etc/cont-init.d/13-nginx exited 0
cont-init: info: running /etc/cont-init.d/14-php
cont-init: info: /etc/cont-init.d/14-php exited 0
cont-init: info: running /etc/cont-init.d/15-keygen
using keys found in /config/keys
cont-init: info: /etc/cont-init.d/15-keygen exited 0
cont-init: info: running /etc/cont-init.d/20-permissions
cont-init: info: /etc/cont-init.d/20-permissions exited 0
cont-init: info: running /etc/cont-init.d/50-config
Go to http://IP-ADDRESS:PORT/install.php to configure your install then restart your container when finished to remove install.php
[cont-init.d] Setting permissions this may take some time
cont-init: info: /etc/cont-init.d/50-config exited 0
cont-init: info: running /etc/cont-init.d/85-version-checks
cont-init: info: /etc/cont-init.d/85-version-checks exited 0
cont-init: info: running /etc/cont-init.d/99-custom-files
[custom-init] No custom files found, skipping...
cont-init: info: /etc/cont-init.d/99-custom-files exited 0
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service init-mods: starting
s6-rc: info: service init-mods successfully started
s6-rc: info: service init-mods-package-install: starting
s6-rc: info: service init-mods-package-install successfully started
s6-rc: info: service init-mods-end: starting
s6-rc: info: service init-mods-end successfully started
s6-rc: info: service init-services: starting
s6-rc: info: service init-services successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun cron (no readiness notification)
services-up: info: copying legacy longrun nginx (no readiness notification)
services-up: info: copying legacy longrun php-fpm (no readiness notification)
s6-rc: info: service legacy-services successfully started
s6-rc: info: service 99-ci-service-check: starting
[ls.io-init] done.
s6-rc: info: service 99-ci-service-check successfully started




六、访问Dokuwiki

image.png

image.png

image.png