GL.iNet MT3600BE (OpenWrt) — Running Docker with a USB Disk

I recently set up Docker on a GL.iNet MT3600BE router running OpenWrt, using a USB disk for storage (since the internal flash is tiny).


:magnifying_glass_tilted_left: Check OpenWrt Version

cat /etc/openwrt_release

Output:

DISTRIB_ID='OpenWrt'
DISTRIB_RELEASE='21.02-SNAPSHOT'
DISTRIB_REVISION=''
DISTRIB_TARGET='mediatek/mt7987'
DISTRIB_ARCH='aarch64_cortex-a53'
DISTRIB_DESCRIPTION='OpenWrt 21.02-SNAPSHOT'
DISTRIB_TAINTS='busybox override'

:floppy_disk: Check Storage Situation

df -h

You’ll likely see something like this:

Filesystem                Size      Used Available Use% Mounted on
/dev/root                62.0M     62.0M         0 100% /rom
tmpfs                   240.6M      5.3M    235.4M   2% /tmp
/dev/ubi0_2             354.3M    624.0K    349.0M   0% /overlay
overlayfs:/overlay      354.3M    624.0K    349.0M   0% /
tmpfs                   512.0K         0    512.0K   0% /dev
/dev/sda1                58.7G     13.3M     58.7G   0% /tmp/mountd/disk1_part1

Key point:

  • Internal flash is way too small for Docker
  • USB disk (/dev/sda1) is where Docker must live

:brick: Check USB Disk File System (Must Be ext4)

mount | grep sda1

If it’s already ext4, you should see something like:

/dev/sda1 on /tmp/mountd/disk1_part1 type ext4 (rw,relatime)

If it’s NOT ext4 (:warning: this will erase the disk)

Umount:

umount /tmp/mountd/disk1_part1

Format:

mkfs.ext4 -F /dev/sda1

Create a mount point:

mkdir -p /tmp/mountd/disk1_part1

Mount it:

mount /dev/sda1 /tmp/mountd/disk1_part1

Verify again:

mount | grep sda1

:spouting_whale: Install Docker

opkg update
opkg install docker dockerd

Check Docker status:

docker info | grep "Docker Root Dir"

By default, you’ll see:

Docker Docker Root Dir: /opt/docker

That’s bad (internal flash).


:repeat_button: Move Docker Root to USB Disk (Symlink Method)

Stop Docker:

/etc/init.d/dockerd stop

Prepare directory on USB disk:

mkdir -p /tmp/mountd/disk1_part1/docker
chmod 755 /tmp/mountd/disk1_part1/docker

Remove the old Docker directory:

rm -rf /opt/docker

Create a symlink to the USB disk:

ln -s /tmp/mountd/disk1_part1/docker /opt/docker

Start Docker again:

/etc/init.d/dockerd start

Verify:

docker info | grep "Docker Root Dir"

Now you should see:

Docker Root Dir: /tmp/mountd/disk1_part1/docker

:white_check_mark: Docker is officially living on the USB disk.


:rocket: Test Docker

docker run --rm docker.m.daocloud.io/library/hello-world

If you see the Hello World output — you’re done :tada:


:white_check_mark: Final Notes

  • ext4 is strongly recommended (don’t use FAT32/exFAT)
  • USB disk avoids storage exhaustion and random Docker crashes
  • This setup works well even on low-power OpenWrt routers

I found that it is necessary to keep External Storage set to USB 3.0 in the GL.iNet dashboard. If I switch it to USB 2.0, Docker fails to work after reboot.
USB 2.0 ports provide up to ~500 mA, and the logs clearly show USB disconnects, blk_update_request: I/O error, EXT4-fs errors with an aborted JBD2 journal, the filesystem switching to read-only mode, and containerd failing with input/output errors

I ran into an issue where the USB drive didn’t mount after a reboot, which caused Docker not to start. I suspect it was due to the 5V/2A power adapter I was using. After switching to the original GL.iNet power adapter, which supports 5V/9V/12V/15V, the issue was resolved