vicv
54 天前
你的网络连接方案和我的是一样的。我的做法是另外起一个容器运行 ddns ,这个 ddns 容器直接使用 emby 容器的网络命名空间就可以了,这样 ddns 容中的网络就是 emby 容器中的网络,其实这就是 K8s 里面的 Sidecar 容器模式。在 docker-compose 中可通过 network_mode 配置 ddns 容器连接到 emby 容器。贴上我的 docker-compose 文件作为参考:
services:
emby:
container_name: emby
image: lovechen/embyserver:latest
cap_add:
- NET_ADMIN
- SYS_ADMIN
- SYS_MODULE
networks:
dmacvlan:
ipv4_address: 192.168.2.2
priority: 1000
dbridge:
ipv4_address: 172.16.2.2
priority: 100
volumes:
- ./emby/config:/config
- ./acme/ssl:/ssl
- /volume/media:/Media
devices:
- /dev/dri:/dev/dri
environment:
- TZ=Asia/Shanghai
- UID=0
- GID=0
- GIDLIST=0
- NVIDIA_VISIBLE_DEVICES=all
restart: always
emby-ddns:
container_name: emby-ddns
image: jeessy/ddns-go:latest
network_mode: "service:emby"
volumes:
- ./emby/.ddns_go_config.yaml:/root/.ddns_go_config.yaml
environment:
- TZ=Asia/Shanghai
depends_on:
emby:
condition: service_started
restart: always
networks:
dmacvlan:
name: dmacvlan
enable_ipv6: true
driver: macvlan
driver_opts:
parent: ovs_eth0
ipam:
config:
- subnet: 192.168.2.0/24
gateway: 192.168.2.1
- subnet: fc00:21:2::/64
gateway: fc00:21:2::1
dbridge:
name: dbridge
ipam:
driver: default
config:
- subnet: 172.16.2.0/24
gateway: 172.16.2.1