赞
踩
CSDN 对 HTML 标签支持的不好,点击跳转我的 Github blog 获取更好的体验。
各设备 IP:
NAS: 192.168.31.20
旧设备: 192.168.31.21
新设备: 192.168.31.31
[/share/Installer/temp_20210811] # docker inspect e153ae723f1a [ { "Id": "e153ae723f1ab69a3c62cc7c926d1ffda268056d38833949e0db83ad7782b2ca", "Created": "2020-03-16T16:16:17.153304574Z", "Path": "./jellyfin/jellyfin", "Args": [ "--datadir", "/config", "--cachedir", "/cache", "--ffmpeg", "/usr/local/bin/ffmpeg" ], "State": { "Status": "exited", "Running": false, "Paused": false, "Restarting": false, "OOMKilled": false, "Dead": false, "Pid": 0, "ExitCode": 143, "Error": "", "StartedAt": "2021-03-10T14:41:26.253973907Z", "FinishedAt": "2021-08-10T17:53:21.548132521Z" }, "Image": "sha256:f4a95483e8262f36c3581d01b4f797f6a625e39f80181d56e0e0329f93d3f12b", "ResolvConfPath": "/share/CACHEDEV1_DATA/Container/container-station-data/lib/docker/containers/e153ae723f1ab69a3c62cc7c926d1ffda268056d38833949e0db83ad7782b2ca/resolv.conf", "HostnamePath": "/share/CACHEDEV1_DATA/Container/container-station-data/lib/docker/containers/e153ae723f1ab69a3c62cc7c926d1ffda268056d38833949e0db83ad7782b2ca/hostname", "HostsPath": "/share/CACHEDEV1_DATA/Container/container-station-data/lib/docker/containers/e153ae723f1ab69a3c62cc7c926d1ffda268056d38833949e0db83ad7782b2ca/hosts", "LogPath": "/share/CACHEDEV1_DATA/Container/container-station-data/lib/docker/containers/e153ae723f1ab69a3c62cc7c926d1ffda268056d38833949e0db83ad7782b2ca/e153ae723f1ab69a3c62cc7c926d1ffda268056d38833949e0db83ad7782b2ca-json.log", "Name": "/jellyfin-1-temporary-1590291633", "RestartCount": 0, "Driver": "overlay2", "Platform": "linux", "MountLabel": "", "ProcessLabel": "", "AppArmorProfile": "", "ExecIDs": null, "HostConfig": { "Binds": [ "/share/jellyfin/cache:/cache", "/share/media:/media", "/share/jellyfin/config:/config" ], "ContainerIDFile": "", "LogConfig": { "Type": "json-file", "Config": {} }, "NetworkMode": "host", "PortBindings": {}, "RestartPolicy": { "Name": "no", "MaximumRetryCount": 0 }, "AutoRemove": false, "VolumeDriver": "", "VolumesFrom": null, "CapAdd": null, "CapDrop": null, "Dns": [], "DnsOptions": [], "DnsSearch": [], "ExtraHosts": null, "GroupAdd": null, "IpcMode": "shareable", "Cgroup": "", "Links": null, "OomScoreAdj": 0, "PidMode": "", "Privileged": false, "PublishAllPorts": false, "ReadonlyRootfs": false, "SecurityOpt": null, "UTSMode": "", "UsernsMode": "", "ShmSize": 67108864, "Runtime": "runc", "ConsoleSize": [ 0, 0 ], "Isolation": "", "CpuShares": 0, "Memory": 0, "NanoCpus": 0, "CgroupParent": "", "BlkioWeight": 0, "BlkioWeightDevice": [], "BlkioDeviceReadBps": null, "BlkioDeviceWriteBps": null, "BlkioDeviceReadIOps": null, "BlkioDeviceWriteIOps": null, "CpuPeriod": 0, "CpuQuota": 0, "CpuRealtimePeriod": 0, "CpuRealtimeRuntime": 0, "CpusetCpus": "", "CpusetMems": "", "Devices": [ { "PathOnHost": "/dev/dri/renderD128", "PathInContainer": "/dev/dri/renderD128", "CgroupPermissions": "rwm" } ], "DeviceCgroupRules": null, "DiskQuota": 0, "KernelMemory": 0, "MemoryReservation": 0, "MemorySwap": 0, "MemorySwappiness": null, "OomKillDisable": false, "PidsLimit": 0, "Ulimits": null, "CpuCount": 0, "CpuPercent": 0, "IOMaximumIOps": 0, "IOMaximumBandwidth": 0 }, "GraphDriver": { "Data": { "LowerDir": "/share/CACHEDEV1_DATA/Container/container-station-data/lib/docker/overlay2/42fae3b91ee5d46d270ba2ac8681c04e9fd7b22d75a8c71bdf25c6af45580cf0-init/diff:/share/CACHEDEV1_DATA/Container/container-station-data/lib/docker/overlay2/cf0759cb81923b0f57e7a909cd174185255e9b617340e97ce454a8eb7fb7a747/diff:/share/CACHEDEV1_DATA/Container/container-station-data/lib/docker/overlay2/f0f31c3cec79753a8471292d9b323bca4f8d53bc1cff712a742b9d36d0ce80b7/diff:/share/CACHEDEV1_DATA/Container/container-station-data/lib/docker/overlay2/b7499b5bf659d5b211f4b10d72599b629f3c3541fb1cbd220a0e1ad602403723/diff:/share/CACHEDEV1_DATA/Container/container-station-data/lib/docker/overlay2/1746d846c3e1ed4cdc6f125ebbd86e830a51935130ab2692c764e692c289d223/diff:/share/CACHEDEV1_DATA/Container/container-station-data/lib/docker/overlay2/ca5b3391c32348ac738d8158be04146e3591cab75b7bb688cf35f07a0067124c/diff", "MergedDir": "/share/CACHEDEV1_DATA/Container/container-station-data/lib/docker/overlay2/42fae3b91ee5d46d270ba2ac8681c04e9fd7b22d75a8c71bdf25c6af45580cf0/merged", "UpperDir": "/share/CACHEDEV1_DATA/Container/container-station-data/lib/docker/overlay2/42fae3b91ee5d46d270ba2ac8681c04e9fd7b22d75a8c71bdf25c6af45580cf0/diff", "WorkDir": "/share/CACHEDEV1_DATA/Container/container-station-data/lib/docker/overlay2/42fae3b91ee5d46d270ba2ac8681c04e9fd7b22d75a8c71bdf25c6af45580cf0/work" }, "Name": "overlay2" }, "Mounts": [ { "Type": "bind", "Source": "/share/jellyfin/cache", "Destination": "/cache", "Mode": "", "RW": true, "Propagation": "rprivate" }, { "Type": "bind", "Source": "/share/jellyfin/config", "Destination": "/config", "Mode": "", "RW": true, "Propagation": "rprivate" }, { "Type": "bind", "Source": "/share/media", "Destination": "/media", "Mode": "", "RW": true, "Propagation": "rprivate" } ], "Config": { "Hostname": "nHan-453Bmini", "Domainname": "", "User": "", "AttachStdin": false, "AttachStdout": true, "AttachStderr": true, "ExposedPorts": { "8096/tcp": {} }, "Tty": false, "OpenStdin": false, "StdinOnce": false, "Env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "NVIDIA_DRIVER_CAPABILITIES=compute,video,utility", "DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1" ], "Cmd": null, "Image": "jellyfin/jellyfin:latest", "Volumes": { "/cache": {}, "/config": {}, "/media": {} }, "WorkingDir": "", "Entrypoint": [ "./jellyfin/jellyfin", "--datadir", "/config", "--cachedir", "/cache", "--ffmpeg", "/usr/local/bin/ffmpeg" ], "OnBuild": null, "Labels": {} }, "NetworkSettings": { "Bridge": "", "SandboxID": "6a5645d3bf40514fee310142bc4ae2a85765f787104cbd2695b2236208ee0782", "HairpinMode": false, "LinkLocalIPv6Address": "", "LinkLocalIPv6PrefixLen": 0, "Ports": {}, "SandboxKey": "/var/run/docker/netns/default", "SecondaryIPAddresses": null, "SecondaryIPv6Addresses": null, "EndpointID": "", "Gateway": "", "GlobalIPv6Address": "", "GlobalIPv6PrefixLen": 0, "IPAddress": "", "IPPrefixLen": 0, "IPv6Gateway": "", "MacAddress": "", "Networks": { "host": { "IPAMConfig": null, "Links": null, "Aliases": null, "NetworkID": "0cade7f3f08c241ceec07a5c1dce07079145a89c2f6500d674f4d367810dab68", "EndpointID": "", "Gateway": "", "IPAddress": "", "IPPrefixLen": 0, "IPv6Gateway": "", "GlobalIPv6Address": "", "GlobalIPv6PrefixLen": 0, "MacAddress": "", "DriverOpts": null } } } } ]
其中 cache, config, media 这几个目录是需要被 copy 到新机器的,其中 media 我是通过 smb 挂载的,所以这里我就无需复制了。
永久挂载,直接修改 /etc/fstab 文件:
sudo cat <<EOF >>/etc/fstab
//192.168.31.20/media /mnt/media cifs defaults,username=YOUR_SMB_USERNAME,password=YOUR_SMB_PASSWORD
EOF
sudo mount -a
如果你要的是临时挂载:
sudo mount -o username=YOUR_SMB_USERNAME,password=YOUR_SMB_PASSWORD //192.168.31.20/media /mnt/media
注意:这里已经安装了 docker, docker-compose
mkdir jellyfin && cd jellyfin
# 将最开始备份的 config, cache 复制到 jellyfin 目录,这里我用的是 rz 命令上传备份 zip 的
rz
unzip jellyfin.zip
此时目录应该有 config, cache 两个目录。然后继续上面的命令启动 docker:
touch docker-compose.yaml cat <<EOF >docker-compose.yaml version: '3' services: jellyfin: image: jellyfin/jellyfin:latest user: 1000:1000 restart: unless-stopped network_mode: host volumes: - ./config:/config - /mnt/media:/media - ./cache:/cache environment: - JELLYFIN_PublishedServerUrl=http://media.home.com EOF sudo docker-compose up -d
注意,这里有个问题,第一次启动时,旧用户密码未加载,需要重启一次 docker 才能正常登录旧用户,原因未知。
sudo apt install nginx
sudo touch /etc/nginx/sites-available/jellyfin
sudo cat <<EOF >/etc/nginx/sites-available/jellyfin
server {
listen 80;
server_name media.home.com;
location / {
proxy_pass http://127.0.0.1:8096;
}
}
EOF
sudo ln -s /etc/nginx/sites-available/jellyfin /etc/nginx/sites-enabled/jellyfin
sudo nginx -s reload
这里我的路由器是 Padavan,所以直接在路由器界面设置即可,以前的配置为:
address=/home.com/192.168.31.21
修改为:
address=/media.home.com/192.168.31.31
address=/home.com/192.168.31.21
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。