警告
本文最后更新于 2023-10-08,文中内容可能已过时。
docker教程
docker安装
卸载老版本docker
1
| sudo apt-get remove docker docker-engine docker.io containerd runc
|
设置apt仓库
- 1.更新apt包索引并且安装相关依赖允许apt使用https更新
1
2
3
4
5
6
7
| sudo apt-get update
sudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release
|
1
| curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
|
1
2
3
| echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
安装Docker引擎
1
2
| sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
|
1
| sudo docker run hello-world
|
1
2
3
| echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
参考文档
Install Docker Engine on Ubuntu | Docker Documentation
Docker Compose安装
Linux
安装Docker Compose
1
| sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
|
1
| sudo chmod +x /usr/local/bin/docker-compose
|
Docker 权限问题
添加当前用户到Docker用户组
1
2
3
| sudo groupadd docker #添加docker用户组,这个用户组应该是已存在了`
sudo gpasswd -a $USER docker #将当前用户加入到docker用户组中`
newgrp docker #更新用户组docker`
|
qBittorrent Docker运行
Docker Compose 配置qBittorrent
新建项目
- 1.进入home目录,新建项目qBittorrent
1
2
3
| cd ~
mkdir qBittorrent
cd qBittorrent
|
- 2.进入项目文件目录,新建配置文件
docker-compose.yml
,配置下载端口,qBittorrent相关目录
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| version: "3"
services:
qbittorrent:
image: emmercm/qbittorrent:latest
restart: unless-stopped
ports:
- 8080:8080
- 5463:5463/tcp
- 5463:5463/udp
volumes:
- ./config:/config
- ./data:/data
- ./downloads:/downloads
- ./incomplete:/incomplete
|
运行项目
1.下载并创建镜像