Docker思源笔记安装

常用路径:
1.使用docker volume create创建的目录位置:
docker volumes:/var/lib/docker/volumes/

2.容器配置文件存放位置:
/var/lib/docker/containers/xxx/

1.debian12换源

nano /etc/apt/sources.list
#deb cdrom:[Debian GNU/Linux 12.7.0 _Bookworm_ - Official amd64 DVD Binary-1 with firmware 20240831-10:40]/ bookworm contrib main non-free-firmware

#ustc
#deb http://mirrors.ustc.edu.cn/debian bookworm main contrib non-free non-free-firmware
# deb-src http://mirrors.ustc.edu.cn/debian bookworm main contrib non-free non-free-firmware
#deb http://mirrors.ustc.edu.cn/debian bookworm-updates main contrib non-free non-free-firmware
# deb-src http://mirrors.ustc.edu.cn/debian bookworm-updates main contrib non-free non-free-firmware
#deb http://mirrors.ustc.edu.cn/debian bookworm-backports main contrib non-free non-free-firmware
# deb-src http://mirrors.ustc.edu.cn/debian bookworm-backports main contrib non-free non-free-firmware

#aliyun
deb https://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib
#deb-src https://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib
deb https://mirrors.aliyun.com/debian-security/ bookworm-security main
#deb-src https://mirrors.aliyun.com/debian-security/ bookworm-security main
deb https://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib
#deb-src https://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb https://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib
#deb-src https://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib

2.安装docker

apt install curl

curl -fsSL https://get.docker.com -o get-docker.sh

DOWNLOAD_URL=https://mirrors.ustc.edu.cn/docker-ce sh get-docker.sh

3.添加镜像加速器

touch /etc/docker/daemon.json
nano /etc/docker/daemon.json
{
  "registry-mirrors" :
    [
      "https://docker.m.daocloud.io",
      "https://noohub.ru",
      "https://huecker.io",
      "https://dockerhub.timeweb.cloud"
    ]
}

systemctl daemon-reload && systemctl restart docker

4.拉取portainer镜像,安装完成后使用https://ip:9443打开管理页面

docker volume create portainer_data

docker run -d -p 8000:8000 -p 9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:2.21.4

5.停止运行中的容器,修改端口

#首先停止容器运行
docker ps -a
#记下CONTAINER ID
docker stop CONTAINER ID

#修改之前必须停止docker
systemctl stop docker
cd /var/lib/docker/containers/
#之后再进入对应容器文件夹,修改hostconfig.json

6.创建siyuan

docker run -d \
  -v /vol1/1000/siyuan:/siyuan/workspace \
  -p 6806:6806 \
  -e PUID=1001 -e PGID=1002 \
  b3log/siyuan \
  --workspace=/siyuan/workspace/ \
  --accessAuthCode=xxxxxx
  
 #-v 前面为存储空间路径,后面为挂载点
 #-p 前面为web登陆端口,后面为容器端口,只改前面端口
 #--accessAuthCode= 后为自行设置的登陆认证码

安装完其实也就是个客户端而已,不是服务端,只是比Linux的客户端多一个自启动,Linux客户端关闭web界面后服务就停止了,docker关闭后还会后台运行,方便持续使用

posted @ 2024-11-05 15:51  ippondo  阅读(51)  评论(0编辑  收藏  举报