https://techexpert.tips/zh-hans/nginx-zh-hans/nginx-docker-%e5%ae%89%e8%a3%85/

  1. apt-get update
  2. apt-get install docker.io
  3. docker pull nginx
  4. ╭─zcz@zcz-pc ~
  5. ╰─$ docker images
  6. REPOSITORY TAG IMAGE ID CREATED SIZE
  7. nginx latest ea335eea17ab 11 days ago 141MB

开始

创建持久化数据

  1. docker volume create nginx-data
  2. # 检查数据
  3. ╭─zcz@zcz-pc ~
  4. ╰─$ docker volume inspect nginx-data
  5. [
  6. {
  7. "CreatedAt": "2021-11-28T23:59:23+08:00",
  8. "Driver": "local",
  9. "Labels": {},
  10. "Mountpoint": "/var/lib/docker/volumes/nginx-data/_data",
  11. "Name": "nginx-data",
  12. "Options": {},
  13. "Scope": "local"
  14. }
  15. ]

可选地,创建一个符号链接到更容易访问的位置。
···