v7.1rc3 adds container support

Discussion topic about release from here:
http://forum.mikrotik.com/t/v7-1rc3-development-is-released/151711/1

Manual (being updated): https://help.mikrotik.com/docs/x/KYAPBQ

  1. you need a container tar archive
  2. relevant menus:
 
  interface/veth
  container
  1. super basic example:
1. Get Docker image as tar archive and copy to router (currently there is no 'pull' command in RouterOS, so containers should be exported from a working Docker environment). Also note that container's architecture should match with the router's.
-----------------------------------------------------

  $ docker pull docker/example-container
  $ docker save docker/example-container > my-container.tar

2. Add veth interface for the container
---------------------------------------

  [admin@MikroTik] > /interface/veth/add name=veth1 address=172.17.0.2/16 gateway=172.17.0.1


3. Create bridge for containers and add veth to it
--------------------------------------------------

  [admin@MikroTik] > /interface/bridge/add name=docker
  [admin@MikroTik] > /ip/address/add address=172.17.0.1/16 interface=docker
  [admin@MikroTik] > /interface/bridge/port add bridge=docker interface=veth1


4. Setup NAT for outgoing traffic
---------------------------------

  [admin@MikroTik] > /ip/firewall/nat/add chain=srcnat action=masquerade src-address=172.17.0.0/16


5. Create environment variables for container if needed
-------------------------------------------------------

  [admin@MikroTik] > /container/envs/add list=foo name=SECRET value=12345678
  [admin@MikroTik] > /container/envs/add list=foo name=FOO value=bar


6. Define mounts if needed
--------------------------

  [admin@MikroTik] > /container/mounts/add name=etc src=disk1/etc dst=/etc
  [admin@MikroTik] > /container/mounts/add name=opt src=disk1/opt dst=/opt

If ``src`` directory does not exist on first time use then it will be populated
with whatever container have in ``dst`` location.


7. Create container from image tar
----------------------------------

  [admin@MikroTik] > /container/add file=my-container.tar interface=veth1 envlist=foo root-dir=disk1/foo mounts=etc,opt

Use ``logging=yes`` to see container output in log with tags
``container,debug,info``.


8. Make sure container has been added and status is stopped
-----------------------------------------------------------

  [admin@MikroTik] > container/print

9. Redirect port 8080 traffic to container
------------------------------------------

  [admin@MikroTik] > /ip/firewall/nat/add chain=dstnat action=dst-nat to-addresses=172.17.0.2 to-ports=80 protocol=tcp dst-port=8080


10. Start container
-------------------

  [admin@MikroTik] > /container/start 0

Answering to @anav (question posted in generic v7.1rc3 thread) …


Docker is one of many implementations for running containers. More about containerization.

In short: this is advanced stuff that will replace metarouter, but is much more flexible. If one doesn’t know what to do with metarouter, then likely he won’t know what to do with docker.

In future versions there is support for making a total backup of routerboard than contain docker, or like user-manager separate .tar file?

and export the single Docker on .tar for put it on another RouterBOARD?

Wow! They did it!
That should put an end to the many +1 +1 +1 topics once and for all.
Now most requested features can simply be added by users, instead of always having to go to MikroTik with requests for niche stuff.

Exactly (really not all, but the majority are useless for 99,9% of users…)

At this point I must change my signature…

An example of how to use container package to run PiHole in RouterOS can be found here

Actually we can start a few +1 threads about removing some useless functionality from system package … One prime example would be support for SMB (file services). Or (borken) DNS service. Or (your suggestion here).

Hmmm. Container menu is missing for me on my RB4011 and CHR. I upgraded via the built-in upgrade facility. User error or MikroTik build error? :wink:

[ali@chr01] > /container
bad command name container (line 1 column 2)

Have You installed the container.npk package (as with ZeroTier - container is a seperate package)

Thanks for that! Where was that info? Didn’t see that when scrolling through the release notes, the forum posts or the wiki docs. Am I being blind?

*) added Zerotier ™ support for ARM and ARM64;
= download separate package zerotier because now this RouterOS support this

*) added support for running Docker ™ containers;
= download separate package container because now this RouterOS support this

It would be nice when available packages could be listed and installed from the packages menu!
Either on a separate window or by just listing all packages and have some status like not installed, disabled, installed.
(so you can install a package just as easily as you can uninstall, disable or upgrade it)

NO, PLEASE NO!

dumb user still exist…
Device “bricked” because the space is depleted (hAP ac)…

http://forum.mikrotik.com/t/damaged-wireless-package-bad-image-6/151691/1

That is simply awesome!

100% nice addition to ROS!
Kudos to bringing this feature to 7.1, it opens great possibilities of finally running your own code on ROS.

Please add an example to run mDNS using container.

Write yourself the Docker

How do we get any logging output, or attach to a container console?

I have attempted to import the Alpine Armv6/v7 container to a RB4011 and neither will start and there is no log output

This is a great feature as it will enable things like running a small Zabbix proxy on a CHR or onsite router

Just searched on Google mDNS proxy Docker
https://hub.docker.com/r/hausgold/mdns-proxy/