Docker安装
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# 卸载docker
sudo apt remove docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc
# 安装必要软件
sudo apt install ca-certificates curl gnupg lsb-release
# 添加密钥目录
sudo install -m 0755 -d /etc/apt/keyrings
# 导入docker的GPG密钥
curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
# 给秘钥加权限
sudo chmod a+r /etc/apt/keyrings/docker.gpg
# 添加仓库
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] http://mirrors.aliyun.com/docker-ce/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# 祖传的更新
sudo apt update
# 安装
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
# 查看docker版本
docker -v
# 运行 hello world,出现如下错误,reboot重启虚拟机即可
songqj@ubuntu:/etc/systemd/system$ sudo docker run hello-world
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
|
下面可选
1
2
3
4
5
6
7
8
|
# 添加docker用户组
sudo groupadd docker
# 把你的用户加入docker组
sudo usermod -aG docker $USER
# 祖传重启
sudo reboot
|
~~ 更换docker源 ~~
源很容易失效,不如找个靠谱点的镜像站
sudo vim /etc/docker/daemon.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
{
"registry-mirrors": [
"https://docker.m.daocloud.io",
"https://dockerproxy.com",
"https://9cpn8tt6.mirror.aliyuncs.com",
"https://mirror.baidubce.com",
"https://ccr.ccs.tencentyun.com",
"https://docker.nju.edu.cn",
"https://docker.mirrors.ustc.edu.cn",
"https://registry.docker-cn.com",
"https://mirror.ccs.tencentyun.com",
"http://hub-mirror.c.163.com",
"https://dockerhub.azk8s.cn",
"https://docker.mirrors.sjtug.sjtu.edu.cn",
"https://registry.cn-hangzhou.aliyuncs.com"
]
}
|
重启 docker
sudo systemctl restart docker
安装 portainer
把目录改成自己的目录
1
2
3
4
5
6
7
8
9
10
|
services:
portainer:
image: swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/portainer/portainer:latest
container_name: portainer
ports:
- "9999:9000"
volumes:
- /home/songqj/docker/portainer/data:/data
- /var/run/docker.sock:/var/run/docker.sock
restart: unless-stopped
|
也可以安装中文版
1
2
3
4
5
6
7
8
9
10
11
|
services:
portainer:
image: ghcr.io/outlovecn/portainer-cn:main
container_name: portainer-cn
restart: always
ports:
- "9998:9000"
- "8000:8000"
volumes:
- ./data:/data
- /var/run/docker.sock:/var/run/docker.sock
|
管理多台docker
1
2
3
4
5
6
|
# 进入另一台docker宿主机
sudo vim /usr/lib/systemd/system/docker.service
#找到ExecStart这行,注释掉原来的,改成下面这行
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock -H tcp://0.0.0.0:2375
sudo systemctl daemon-reload
sudo systemctl restart docker
|
Emby开心版
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
services:
embyserver:
privileged: true
image: 'swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/amilys/embyserver:latest'
network_mode: host
container_name: emby
volumes:
- '/home/songqj/docker/emby/config:/config'
- '/mnt/nfs-media:/media'
environment:
- TZ=Asia/Shanghai
devices:
- '/dev/dri:/dev/dri'
restart: unless-stopped
|
alist
1
2
3
4
5
6
7
8
9
10
11
12
13
|
services:
alist:
image: 'xhofe/alist:beta'
container_name: alist
volumes:
- './config:/opt/alist/data'
ports:
- '5244:5244'
environment:
- PUID=0
- PGID=0
- UMASK=022
restart: unless-stopped
|
给alist设置新密码:``docker exec -it alist ./alist admin setadmin
Qbittorrent
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
services:
qbittorrent:
image: linuxserver/qbittorrent
container_name: qbittorrent
environment:
- PUID=1000
- PGID=1000
- TZ=Asia/Shanghai # 你的时区
- UMASK_SET=022
- WEBUI_PORT=8081 # 将此处修改成你欲使用的 WEB 管理平台端口
volumes:
- ./config:/config # 绝对路径请修改为自己的config文件夹
- /mnt/nfs_media/downloads:/downloads # 绝对路径请修改为自己的downloads文件夹
ports:
# 要使用的映射下载端口与内部下载端口,可保持默认,安装完成后在管理页面仍然可以改成其他端口。
- 6881:6881
- 6881:6881/udp
# 此处WEB UI 目标端口与内部端口务必保证相同,见问题1
- 8081:8081
restart: unless-stopped
|
Transmission
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
services:
transmission:
image: linuxserver/transmission:latest
container_name: transmission
environment:
- PUID=1000 # 使用的用户ID
- PGID=1000 # 使用的组ID
- TZ=Asia/Shanghai # 设置你的时区(例如: Asia/Shanghai)
- TRANSMISSION_WEB_HOME=/webui # 这是一个可选的web UI设置
- USER=admin # 可选,设置用户名
- PASS=你的密码 # 可选,设置密码
volumes:
- ./webui:/webui # 配置文件路径
- ./config:/config # 配置文件路径
- /mnt/nfs_media/downloads:/downloads # 下载文件保存路径
- ./watch:/watch # 自动添加种子的文件夹路径
ports:
# 要使用的映射下载端口与内部下载端口,可保持默认,安装完成后在管理页面仍然可以改成其他端口。
- 51413:51413
- 51413:51413/udp
# 此处WEB UI 目标端口与内部端口务必保证相同,见问题1
- 8082:9091
restart: unless-stopped
|
Overseerr
1
2
3
4
5
6
7
8
9
10
11
|
services:
overseerr:
image: sctx/overseerr:latest
container_name: overseerr
environment:
- TZ=Asia/Shanghai
ports:
- 5055:5055
volumes:
- ./config:/app/config
restart: unless-stopped
|
MoivePilot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
services:
moviepilot:
image: jxxghp/moviepilot-v2:latest
stdin_open: true
tty: true
container_name: moviepilot-v2
hostname: moviepilot-v2
network_mode: host
volumes:
- '/home/songqj/docker/tbit/config/torrents:/tr'
- '/home/songqj/docker/qbit/config/qBittorrent/BT_backup:/qb'
- '/mnt/nfs_media/downloads:/downloads'
- './config:/config'
- './core:/moviepilot/.cache/ms-playwright'
- '/var/run/docker.sock:/var/run/docker.sock:ro'
environment:
- 'NGINX_PORT=3000'
- 'PORT=3001'
- 'PUID=0'
- 'PGID=0'
- 'UMASK=000'
- 'TZ=Asia/Shanghai'
- 'SUPERUSER=admin'
restart: unless-stopped
|
Ddns-go
1
2
3
4
5
6
7
8
|
services:
ddns-go:
image: ghcr.io/jeessy2/ddns-go
container_name: ddns-go
restart: always
network_mode: host
volumes:
- /home/songqj/docker/ddns-go:/root
|
iyuu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
services:
iyuuplus-dev:
stdin_open: true
tty: true
volumes:
- ./iyuu:/iyuu
- ./data:/data
- /Users/qijian.song/Docker/transmission:/tbit
- /Users/qijian.song/Docker/qbit/config/qBittorrent/BT_backup:/qbit
ports:
- "8780:8780"
container_name: IYUUPlus
restart: always
image: iyuucn/iyuuplus-dev:latest
|