Community discussions

MikroTik App
 
zleppy
just joined
Topic Author
Posts: 2
Joined: Mon Jul 14, 2014 12:28 pm

7.4beta4 Testing Docker containers

Mon Jun 20, 2022 4:23 pm

I was wondering does anyone know if you can mount a config file in a docker container.
like this

-v /path/to/config.yml:/app/config.yml

i tried this

/container/mounts/add name=config src=disk1/path/to/config.yml dst=/app/config.yml

but the container can't see the file and/or load it.

Is this not possible currently?
 
User avatar
antonsb
MikroTik Support
MikroTik Support
Posts: 385
Joined: Sun Jul 24, 2016 3:12 pm
Location: Riga, Latvia

Re: 7.4beta4 Testing Docker containers

Mon Jun 20, 2022 4:28 pm

have you added this mount entry to container as well?
/container set 0 mounts=config
Please use main container thread for questions regarding containers.
viewtopic.php?t=178342
 
DeviceLocksmith
just joined
Posts: 24
Joined: Sat Jan 15, 2022 8:21 am

Re: 7.4beta4 Testing Docker containers

Wed Jun 22, 2022 2:02 am

Here is a working example of a mount:
/interface bridge
add name=containers
/interface bridge port
add bridge=containers interface=unifi-controller
/interface veth
add address=192.168.102.2/25 gateway=192.168.102.1 name=unifi-controller
/ip address
add address=192.168.102.1/25 interface=containers network=192.168.102.0
/container mounts
add dst=/config name=unifi-controller_config src=/disk1/containers/unifi-controller/config
/container
add file=disk1/unifi-controller.tar hostname=unifi interface=unifi-controller logging=yes mounts=unifi-controller_config root-dir=disk1/containers/unifi-controller workdir=/usr/lib/unifi
start 0
 
zleppy
just joined
Topic Author
Posts: 2
Joined: Mon Jul 14, 2014 12:28 pm

Re: 7.4beta4 Testing Docker containers

Fri Jun 24, 2022 11:54 pm

yeh im not trying to import a container *tar.gz tarball.

Im trying to mount in a custom config file into the docker img. So far i cant find a way to do it.

skipping network config and repo part...

/container/mounts/add name=blocky_config src=disk1/containers/blocky001/config.yml dst=/app/
/container add hostname=blocky001 interface=veth1 logging=yes mounts=blocky_config root-dir=disk1/containers/blocky remote-image=spx01/blocky:latest

This should show the config file at /app inside the container but all i can find in the log is that the it cant find it.
 
User avatar
devinganger
just joined
Posts: 10
Joined: Wed Jun 10, 2020 10:10 pm
Location: Monroe, WA, USA
Contact:

Re: 7.4beta4 Testing Docker containers

Mon Jul 04, 2022 7:11 am

/container/mounts/add name=blocky_config src=disk1/containers/blocky001/config.yml dst=/app/
/container add hostname=blocky001 interface=veth1 logging=yes mounts=blocky_config root-dir=disk1/containers/blocky remote-image=spx01/blocky:latest

This should show the config file at /app inside the container but all i can find in the log is that the it cant find it.

From my (very limited) experience, the mounts point to directories on your RoS filesystem. The contents of those directories are not seen.

For example:
[admin@MYROSDEVICE] /container/mounts> print
 0 name="pihole-etc" src="/disk3/docker/pihole/mount/etc" dst="/etc/pihole"
 1 name="pihole-etc-dnsmasq.d" src="/disk3/docker/pihole/mount/etc-dnsmasq.d" dst="/etc/dnsmasq.d"

[admin@MYROSDEVICE] /file> print
Columns: NAME, TYPE, SIZE, CREATION-TIME
 #  NAME                      TYPE             SIZE      CREATION-TIME       
 1  disk3/docker              directory                  jun/29/2022 15:20:47
 2  disk3/docker/pihole       directory                  jun/29/2022 15:20:47
 3  disk3/docker/pihole/root  container store            jun/29/2022 15:22:17

Even though the mounts point to directories, not individual files, and you don't see the full target directory, the configuration files for pihole and dnsmasq.d are being persisted across start/stop of the container.

Who is online

Users browsing this forum: cciprian and 24 guests