HUB
Sign inSign up

wiktorbgu/mihomo-mikrotik

By wiktorbgu

•Updated 4 days ago

MIHOMO (fork Clash) for Mikrotik! Very fast and easy!

Image
Networking
Security
41

100K+

wiktorbgu/mihomo-mikrotik repository overview

Chat https://t.me/it_network_people⁠

⁠This container Mihomo provide tunnel gateway and mixed proxy port (1080) for SOCKS and HTTP(S), available with the default configuration


⁠🐳 Docker Build Variants

BuildDisk UsageDocker TagDescription
👀 Standard64 MBlatestRecommended for most users
🌚 gVisor73.3 MBgvisorgVisor support
🔥 UPX28.3 MBupxReduced size with UPX
🔥 UPX + gVisor29.5 MBupx-gvisorUPX compression with gVisor support
⁠Which variant should I choose?
  • Standard (latest) — recommended for most users.
  • gVisor — if you need gVisor support, especially for outbound Tailscale.
  • UPX — if minimizing disk usage is important.
  • UPX + gVisor — if you need both features.

Recommendation: Choose Standard (latest) if your device has limited RAM, predictable performance is important, or you run multiple instances. UPX is worth considering when reducing image size and disk usage is more important than the potential additional RAM and CPU overhead. Compare resource consumption on your target device under your typical workload.

ARMv5: UPX compression is disabled. Binaries remain uncompressed.


⁠Mikrotik settings

/interface/bridge add name=Bridge-Docker port-cost-mode=short
/ip/address add address=192.168.254.1/24 interface=Bridge-Docker network=192.168.254.0
/interface/veth add address=192.168.254.3/24 gateway=192.168.254.1 name=MIHOMO
/interface/bridge/port add bridge=Bridge-Docker interface=MIHOMO

⁠For simple starting set ENV parameter SRV or SUB one or more:

/container envs add list=MIHOMO key=SRV1 value="vless://..."
/container envs add list=MIHOMO key=SRV2_TEST value="ss://..."
/container envs add list=MIHOMO key=SUB1 value="https://free..."
/container envs add list=MIHOMO key=SUB2_TEST value="https://my_subs..."

⁠For use Wireguard/AmneziaWG 3.1 configs

⁠mount awg configurations dir

/container mounts add dst=/etc/mihomo/awg list=MIHOMO_AWG src=/usb1/docker_configs/mihomo_mikrotik/awg
⁠and copy your config *.conf files wireguard/amneziawg to mount dir /usb1/docker_configs/mihomo_mikrotik/awg

⚠️ Important
Config files must use LF (Unix) line endings.
Files with CRLF will not work.

⁠install container
/container add envlists=MIHOMO interface=MIHOMO logging=yes remote-image=registry-1.docker.io/wiktorbgu/mihomo-mikrotik root-dir=/usb1/docker/mihomo-mikrotik dns=1.1.1.1,8.8.8.8,9.9.9.9 
# add these options to the command above if you are using mount
mountlists=MIHOMO_MIKROTIK,MIHOMO_AWG
# add this for more userfrendly ui
/container envs add list=MIHOMO key=EXTERNAL_UI_URL value="https://github.com/Zephyruso/zashboard/releases/latest/download/dist.zip"  
/container envs add list=MIHOMO key=LOG_LEVEL value="error"  
⁠run container and open web panel on port 9090 for manual change destination server in SELECTOR!

http://192.168.254.3:9090/ui/#/setup?hostname=192.168.254.3&port=9090&secret=⁠
or use online web panel => https://wiki.metacubex.one/en/startup/web/⁠

⁠You can change preset ENV and set additional variables:

LOG_LEVEL=error
UI_SECRET="sgddshje54w532tge54"
EXTERNAL_UI_URL="https://github.com/MetaCubeX/Yacd-meta/archive/refs/heads/gh-pages.zip"
# or dist.zip (7.8MB) – Includes better font-loading experience.
EXTERNAL_UI_URL="https://github.com/Zephyruso/zashboard/releases/latest/download/dist.zip"
# or dist-cdn-fonts.zip (1.4MB) – Optimized for devices with limited storage, fonts loaded from CDN.
EXTERNAL_UI_URL="https://github.com/Zephyruso/zashboard/releases/latest/download/dist-cdn-fonts.zip"

https://wiki.metacubex.one/en/startup/web/⁠

⁠More options:

for flexibility of manual control it is necessary to mount the config directory

/container mounts add dst=/etc/mihomo name=MIHOMO_MIKROTIK src=/usb1/docker_configs/mihomo_mikrotik

⁠Tips and tricks

  • The cmd parameter in MikroTik container settings is passed directly to Mihomo
    (for CLI help, set cmd="-h", run the container, and check the logs).
  • Do not modify the default configuration file in template dir default_config.yaml —
    it will be automatically restored to its original state.
  • You can place your configuration file directly in the working directory
    (no template required).
  • If you prefer using templates, place them in the /template directory.
  • You may define and use any custom variables inside template files.
  • To quickly switch between templates, use the environment variable:
    CONFIG="my_custom_config.yaml"
  • The /user_sh directory is intended for custom shell scripts.
    All scripts in this directory are sourced and executed in the current shell environment during container startup.
  • Scripts in /user_sh share the same environment as the main entrypoint,
    allowing you to extend functionality without modifying the entrypoint itself.

⚠️ Template debugging:
Mihomo will point to the error line in the config, example
Parse config error: yaml: line 83: could not find expected ':'
which is located a directory higher in the WORKDIR with the same name as the template file itself, because variables can be filled with multi-line data

Шаблоны конфигураций Mihomo https://github.com/wiktorbgu/mihomo-templates⁠
https://github.com/Viktor45/mh-templates⁠
для тех, кому не хватает встроенного и хочется чего-то большего

⁠Custom configs - read official manual https://wiki.metacubex.one/en/config/⁠

⁠GitHub⁠

⁠Dоnate ♥⁠

Tag summary

Content type

Image

Digest

sha256:811ee9525…

Size

51.1 MB

Last updated

4 days ago

docker pull wiktorbgu/mihomo-mikrotik