日常记录> 正文

常用的docker容器构建命令

2023-06-03T16:21:33+08:00

  我常用的docker容器构建命令。

  1、superng6/qbittorrentee:

docker pull superng6/qbittorrentee

docker create  \
    --name=qbittorrentee  \
    -e WEBUIPORT=8080  \
    -e PUID=1026 \
    -e PGID=100 \
    -e TZ=Asia/Shanghai \
    -v /opt/qbittorrentee/config:/config  \
    -v /mnt/u_disk/downloads:/downloads  \
    -v /opt/qbittorrentee/qb-web:/qb-web  \
    --restart unless-stopped  \
    superng6/qbittorrentee:latest

  2、ubuntu/nginx:

docker pull ubuntu/nginx

docker create  \
    --name=qbittorrubuntu-nginxentee  \
    -v /opt/nginx/log:/var/log/nginx  \
    -v /opt/nginx/www:/var/www/html  \
    -v /opt/nginx/sites-enabled:/etc/nginx/sites-enabled  \
    --restart unless-stopped  \
    ubuntu/nginx:1.18-22.04_beta

  3、Alist:

docker pull xhofe/alist

docker run -d  \
    --name="alist"  \
    -v /etc/alist:/opt/alist/data \
    -v /mnt/u_disk:/mnt/u_disk \
    -p 8000:5244 \
    -e PUID=0  \
    -e PGID=0  \
    -e UMASK=022  \
    --restart=always \
    xhofe/alist:latest

获取alist默认密码命令:

docker exec -it alist ./alist admin

  4、syncthing/syncthing

# syncthing使用host网络好一些
docker pull syncthing/syncthing

docker run -d  \
--net=host  \
--name syncthing  \
-v /mnt/u_disk/syncthing_data:/var/syncthing  \
--restart=always \
syncthing/syncthing

  5、linuxserver/transmission

docker pull linuxserver/transmission
# watch:种子目录
# TRANSMISSION_WEB_HOME:自定义web页面目录
# 9091:webui端口
# HOST_WHITELIST:允许访问的ip
# WHITELIST:
docker run -d \
  --name=transmission \
  -e PUID=1000 \
  -e PGID=1000 \
  -e TZ=Asia/Shanghai \
  -e TRANSMISSION_WEB_HOME=/webui \
  -e USER=admin \
  -e PASS=123456 \
  -e WHITELIST=  \
  -e PEERPORT=  \
  -e HOST_WHITELIST=  \
  -p 9091:9091 \
  -p 51413:51413 \
  -p 51413:51413/udp \
  -v /opt/transmission/config:/config \
  -v /mnt/u_disk/downloads:/downloads \
  -v /opt/transmission/watch:/watch \
  -v /opt/transmission/config/webui:/webui \
  --restart unless-stopped \
  lscr.io/linuxserver/transmission:latest

docker stop transmission docker rm -f transmission

安装第三方UI界面 1. 下载想要的webui,如 https://github.com/ronggang/transmission-web-control

  1. 将压缩包里的src目录及其下文件解压至"config"映射的服务器文件夹 (/opt/transmission/webui)

  2. 新建一个docker映射 "webui" 到 服务器“/opt/transmission/config/webui

  3. 将 TRANSMISSION_WEB_HOME 的值改为 “/webui"

  6、Ubuntu配置Docker服务器Proxy

在Ubuntu上配置Docker服务器Proxy非常简单,只需要编辑 /etc/default/docker

export http_proxy="http://127.0.0.1:3128/"

按照上述配置完成后重启:

sudo systemctl restart docker

  7、安装aria2和AriaNg

一般来说p3terx/aria2-pro是最常用的aria2镜像,但是我使用时出现了不能完全初始化导致不能启动的问题,看日志是需要启动时下载一些文件,而这些文件因为网络的原因不能正常下载,所以选择了superng6/aria2镜像,这个镜像集成了AriaNg,更方便了。

UID和GID关系到下载的文件的权限问题,默认是root权限,很难管理。

获得UID和GID:输入 id 获取到UID和GID,替换命令中的PUID、PGID,也可以不使用-e PUID、-e PGID

如果启用IPV6需要在config文件夹下编辑aria2.conf文件:

# 禁用IPv6, 默认:false
disable-ipv6=false
# 打开IPv6 DHT功能, PT需要禁用
enable-dht6=true
docker run -d \
  --name=aria2 \
  -e PUID=1026 \
  -e PGID=100 \
  -e TZ=Asia/Shanghai \
  -e SECRET=yourtoken \
  -e CACHE=512M \
  -e PORT=6800 \
  -e BTPORT=32516 \
  -e WEBUI=true \
  -e WEBUI_PORT=8080 \
  -e UT=true \
  -e RUT=true \
  -e FA=falloc \
  -e QUIET=true \
  -e SMD=true \
  -p 32516:32516 \
  -p 32516:32516/udp \
  -p 6800:6800 \
  -p 8080:8080 \
  -v $PWD/config:/config \
  -v $PWD/downloads:/downloads \
  --restart unless-stopped \
  superng6/aria2:webui-latest

部署 AriaNg:

superng6/aria2镜像不需要单独部署。

host 网络模式(如果你需要使用 IPv6 网络访问,这是最简单的方式):--network host \

docker run -d \
    --name ariang \
    --log-opt max-size=1m \
    --restart unless-stopped \
    -p 6880:6880 \
    p3terx/ariang

  8、Docker安装怎么更新

两种方法:

1docker ps -a #查看容器(找Alist容器的ID)

2docker stop ID #停止Alist运行,不然无法删除(这次Alist容器的ID是d429749a6e69每一次安装都不一样自己看)

3docker rm ID #删除Alist容器(数据还在只要你不手动删除)

4docker pull xhofe/alist:latest

5输入安装命令

6更新好了 去看看吧..就这么简单

  也可以使用Watchtower工具。

分享到:

Ranvane的日常记录

关于我们 客服中心 广告服务 法律声明