zleppy
June 20, 2022, 1:23pm
1
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?
have you added this mount entry to container as well?
/container set 0 mounts=config
Please use main container thread for questions regarding containers.
http://forum.mikrotik.com/t/v7-1rc3-adds-container-support/151712/1
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
June 24, 2022, 8:54pm
4
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.
/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.