docker stack with wrong network mode

Discussion of applications not mentioned above.
Post Reply
User avatar
Mikekrnboy
Posts: 3
Joined: 08 Jan 2026, 19:44
United States of America

docker stack with wrong network mode

Post by Mikekrnboy »

mmy device is
Device name: TNAS-0F4A
Model: F4-423
TOS version: TOS_X642.0_5.1.145

after launching a Docker stack my yaml is
version: '3'
services:
android:
image: redroid/redroid:11.0.0-latest
container_name: android_container
privileged: true
network_mode: host # Directly uses NAS IP, bypassing bridge issues
volumes:
- /run/dbus:/run/dbus:ro
- /dev/bus/usb/001/006:/dev/bus/usb/001/006
devices:
- "/dev/bus/usb/001/006:/dev/bus/usb/001/006"
- "/dev/dri:/dev/dri"
environment:
- androidboot.use_memfd=1
- androidboot.redroid_gpu_mode=guest
restart: always


this broke the network network_mode: host # Directly uses NAS IP, bypassing bridge issues with restart: always
User avatar
TMzethar
TM Support
Posts: 2819
Joined: 27 Oct 2020, 16:43

Re: docker stack with wrong network mode

Post by TMzethar »

Hi. Are you saying that after enabling privileged mode, there is an abnormality in the container's network or the NAS's network?
To contact our team, please send email to following addresses, remember to replace (at) with @:
Technical team: support(at)terra-master.com (for technical support)
Service team: service(at)terra-master.com (for purchasing, return, replacement, RMA service)
User avatar
Mikekrnboy
Posts: 3
Joined: 08 Jan 2026, 19:44
United States of America

Re: docker stack with wrong network mode

Post by Mikekrnboy »

i resolved it:

The Problem
A Docker container is set to network_mode: host and restart: always. It conflicts with the TOS System (usually on Port 80/443), causing the web interface to hang at "Please Wait" and causing the network to crash or loop.

2. The "Skeleton" Startup
Power Down: Turn off the NAS.

Pull the Drives: Pull all HDDs out about 2 inches (just enough to disconnect from the backplane). Label them 1, 2, 3, 4!

The Skeleton Drive: Insert Drive 1 only.

Boot: Power on the NAS.

The OS Load: The NAS will boot the OS into RAM from the single drive. It will likely show a "Fresh Install" or "Ready" screen because the RAID volume is missing. This is good—Docker cannot start because the @apps folder is not mounted.

3. Manual RAID Assembly (The "Secret" Access)
Once you are logged into SSH (Putty) on the 1-drive system, insert the other 3 drives while it is running. Wait 30 seconds for the system to detect them, then run:

1. Identify the Partitions
First, we need to see which partitions belong to the Data RAID. On TerraMaster, the large data partition is almost always the 4th partition (e.g., sda4, sdb4).

Bash

lsblk
Look for the 4 drives and confirm they all have a large partition ending in 4 (e.g., 3.6T or 14.5T).

2. Manual Assembly (No Scanning)
Instead of scanning, we call the drives specifically. This prevents the OS from "auto-mounting." (Replace sda4, sdb4, etc., with your actual drive letters from the lsblk command).

Bash

mdadm --assemble /dev/md0 /dev/sda4 /dev/sdb4 /dev/sdc4 /dev/sdd4
3. Check for LVM (The Volume Layer)
TerraMaster uses LVM (Logical Volume Management) on top of the RAID. We need to find the Volume Group name.

Bash

pvscan
It will likely show VG vg0. If it says "inactive," we wake it up manually:

Bash

vgchange -ay vg0
4. Find the Exact Mount Path
Now we need the name of the Logical Volume to mount it.

Bash

lvdisplay
Look for the "LV Path". It is usually /dev/vg0/lv0 or /dev/mapper/vg0-lv0.

5. The "Secret" Mount
This is the most important step. We do NOT mount it to /Volume1. If we do, the system scripts will see it and start the apps. We mount it to a custom folder instead:

Bash

mkdir -p /mnt/recovery
mount /dev/mapper/vg0-lv0 /mnt/recovery
🔍 How to Verify You Are Safe
Once mounted to /mnt/recovery, check that you can see the apps without them being "active":

Bash

ls /mnt/recovery/@apps

The "Disarm" Commands (The Payload)
While the drives are in this "hidden" state, run the fix:

Bash

# Force ALL containers to "Restart: No"
find /mnt/recovery/@apps/DockerEngine/DockerData/containers/ -name "hostconfig.json" -exec sed -i 's/"RestartPolicy":{"Name":"[^"]*"/"RestartPolicy":{"Name":"no"/g' {} +
Summary for your records:
Identify: lsblk

Assemble: mdadm --assemble /dev/md0 /dev/sd[abcd]4

Activate: vgchange -ay vg0

Hidden Mount: mount /dev/mapper/vg0-lv0 /mnt/recovery

Fix: sed to change RestartPolicy to no.
User avatar
Mikekrnboy
Posts: 3
Joined: 08 Jan 2026, 19:44
United States of America

Re: docker stack with wrong network mode

Post by Mikekrnboy »

i even try renaming mdadm jsut to make sure it doesnt automatically raid configure then mount task
Post Reply

Return to “Others”