多媒体服务器搭建
使用 docker-compose 组合各个 docker
git clone https://github.com/hanxi/media-server-docker-compose.git
cd media-server-docker-compose
docker-compose up -d
docker-compose stop
所有容器都以主机的 /data/
目录为资源存放的文件夹,如果主机是 Linux, /data 文件夹可自行 mount 为某个磁盘,如果主机使用的是 boot2docker, 可以在 virtual box 里面配置共享目录并自动挂载
container_name: aria2 # 容器名字
image: wahyd4/aria2-ui # 镜像名字
ports: # 端口映射,主机:容器
- "8000:80"
- "443:443"
- "6800:6800"
volumes: # 磁盘映射,主机:容器
- /data:/data:rw
environment: # 环境变量
- DOMAIN=:80
# - SSL=true
- RPC_SECRET=HelloWorld # jsonrpc 的 token
- ARIA2_USER=admin # aria2 的用户名
- ARIA2_PWD=12345678 # aria2 的登录密码
- ENABLE_AUTH=true # 开启 aria2 密码验证
restart: always
container_name: bt-tracker
image: hanxi/aria2-bt-tracker
environment:
- ARIA2_URL=http://aria2:6800/jsonrpc
- ARIA2_TOKEN=HelloWorld # 对应上面 aria2 配置的 RPC_SECRET
- TRACKER_URL=https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_all.txt
links:
- aria2:aria2 # 提供直接访问 aria2 容器,对应上面配置的 ARIA2_URL
logging:
driver: "json-file"
options:
max-size: "1m"
restart: always
TRACKER_URL
可以配置成这里的 ngosang/trackerslist 列出的 image: vladgh/minidlna
container_name: minidlna
network_mode: 'host' # 网络模式设为 host
environment:
- MINIDLNA_MEDIA_DIR=/media
- MINIDLNA_FRIENDLY_NAME=MiniDLNA
- MINIDLNA_INOTIFY=yes
- MINIDLNA_NOTIFY_INTERVAL=3
- MINIDLNA_NETWORK_INTERFACE=eth1
volumes:
- /cache/minidlna:/var/lib/minidlna
- /data:/media
logging:
driver: "json-file"
options:
max-size: "1m"
restart: always
MINIDLNA_NETWORK_INTERFACE=eth1
这个需要根据自己的虚拟机网卡情况来修改,这里有介绍 #note-for-macos
If you're using docker on MacOS (this usually means having a VirtualBox VM with a docker installation, which is done by the docker MacOS installer), you need to do some extra steps to get this working. DLNA server & clients need to be on same network but the VirtualBox VM has a NATed network adapter. You need to add a new bridged network adapter:
- Stop the VM:
docker-machine stop default
- Open VirtualBox, select the VM with name "default" and go to its Settings -> Network -> Select an unused Adapter, enable it and select "Bridged Adapter" under "Attached to:" field.
- Start the VM:
docker-machine start default
- From VirtualBox, again select the "default" VM and click on Show. This will open up the terminal of the VM, use
ifconfig
to figure out the new bridged network adapter, say it iseth2
.- Now add
-e NIC=eth2
in the above run command after the-v
switch.
minidlnad -R
命令$ docker-machine ssh default
$ docker exec -it minidlna minidlnad -R
container_name: samba
image: joebiellik/samba-server
network_mode: 'host' # 网络模式设为 host
volumes:
- /data:/mnt
- ./smb.conf:/etc/samba/smb.conf
environment:
- USERNAME=samba # 用户名
- PASSWORD=samba # 密码
logging:
driver: "json-file"
options:
max-size: "1m"
restart: always