Linux,  杂谈

群晖开启macvlan网络并通过compose命令安装docker指定ip

群晖开启macvlan网络,ssh登陆群晖

sudo -i //获取root权限
sudo ip link set eth0 promisc on //混杂模式
docker network create -d macvlan --subnet=192.168.2.0/24 --gateway=192.168.2.1 -o parent=eth0 macnet //将192.168.2.0替换为你的网段,192.168.2.1替换为你的网关,macnet可以随便取名
docker create --name qbittorrent4ab --network macnet --ip=192.168.2.33 superng6/qbittorrentee:latest //创建容器qbittorrent4ab为容器名,可任意更改192.168.2.33为你固定的ip,superng6/qbittorrentee:latest为你拉取的容器镜像

这里更推荐使用compose命令(免去ssh登陆)来进行基于macvlan网络的容器创建,参考如下——

version: "3.8"

services:
  AutoBangumi:
    image: "estrellaxd/auto_bangumi:latest"
    container_name: AutoBangumi
    volumes:
      - ./config:/app/config
      - ./data:/app/data
    ports:
      - "7892:7892"
    restart: unless-stopped
    network_mode: macnet
    networks:
      my-macvlan:
        ipv4_address: 192.168.2.3
    environment:
      - TZ=Asia/Shanghai
      - AB_METHOD=Advance
      - PGID=1026
      - PUID=100
      - UMASK=022

以上是群晖的compose演示,比较简单,一看就会,再来一个——

version: "2.3"
services:
  emby:
    image: lovechen/embyserver:latest
    container_name: embyserver-cp
    network_mode: bridge
    environment:
      - UID=1026
      - GID=100
      - GIDLIST=100,0
    volumes:
      - /volume1/docker/emby:/config
      - /volume1/1/raws-Music:/data
      - /volume4/4:/data1
      - /volume3/3:/data2
      - /volume2/2:/data3
      - /volume1/CloudNAS/CloudDrive2/百度网盘/apps/Cloud Sync/Bangumi:/data4
    ports:
      - 8095:8096 # HTTP port
    devices:
      - /dev/dri:/dev/dri # VAAPI/NVDEC/NVENC render nodes
    restart: unless-stopped

qbittorrent容器会略微有点不一样,随便指定网路名会一直报错,这里找到了如下参考案例:

version: "2.1"
services:
  qbittorrent:
    image: linuxserver/qbittorrent:latest
    container_name: qbittorrent-pt
    restart: always
    tty: true
    networks: 
      macnet:
        ipv4_address: 192.168.2.4
        aliases:
          - qbittorrent
    hostname: qbitorrent
    volumes:
      - /volume1/docker/qbittorrent-pt:/config
      - /volume3/3/PT:/downloads
    environment:
      - WEBUI_PORT=8080   # WEBUI控制端口,可自定义
      - TZ=Asia/Shanghai  # 时区
      - PUID=1026
      - PGID=100
networks: 
  macnet:
    external: true
version: "2.1"
services:
  qbittorrent:
    image: johngong/qbittorrent:4.1.9.1
    container_name: qbittorrent4191
    restart: always
    tty: true
    networks: 
      macnet:
        ipv4_address: 192.168.2.5
        aliases:
          - qbittorrent
    hostname: qbitorrent
    volumes:
      - /volume1/docker/qbittorrent4.1.9.1:/config
      - /volume1/1/downloads/pt:/Downloads
    environment:
      - QB_WEBUI_PORT=8989   # WEBUI控制端口,可自定义
      - TZ=Asia/Shanghai  # 时区
      - PUID=1026
      - PGID=100
      - UMASK=22
      - QB_EE_BIN=false
networks: 
  macnet:
    external: true

另外推荐下矿神源(https://spk7.imnks.com/)的CloudDrive2套件(https://www.clouddrive2.com/),云上番剧,启动!

留言

您的电子邮箱地址不会被公开。 必填项已用 * 标注