cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
747
Views
1
Helpful
2
Replies

IOS XE app-hosting bind mount syntax?

I am working with a Docker container on a C9300, IOS XE 17.4.1. I want to get some configuration files on a USB-attached flash drive into the container with a bind mount. Various documents from Cisco claim this is supported, but none of them say how to do it except for the Programmability Guide, which hints at bind mounts with one of its examples for run-opts:

Device(config-app-hosting-docker)# run-opts 1 "-v $(APP_DATA):/data"

But exactly what $(APP_DATA) means is not explained.


The problem with using the Docker "-v" option is that Cisco filename specifications include a colon, which is used as a delimiter in the argument to the "-v" option, so I tried using the --mount option instead:

  run-opts 3 "--mount type=bind,source=usbflash1:/junk,target=/data,readonly"

 But that got me the error:

% Error: Error while changing app state: 400 Client Error: Bad Request ("invalid mount config for type "bind": invalid mount path: 'usbflash1:/junk' mount path must be absolute")

Using the path "/usbflash1:/junk" gave me a different error:

% Error: App Activation error: Bind volume mount source path - /usbflash1:/junk is not supported

and I tried other variations like "/usbflash1:junk" but got the same "source path is not supported" error.

 

So my question is, does bind mount from a file in the flash filesystem actually work, and if so, how? Thanks!

2 Replies 2

@rfc1149compliant re:  $(APP_DATA) - usually every iox app once started is creating a folder inside the container at /data - this folder can be  access outside through local manager or ioxclient.  Developers can store log files, config files etc there.

 

No idea on the other one sadly.

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

With a bit more documentation exploration and some help from Cisco here are the answers as I understand them:

  • The Docker command-line -v option does not mount flash drive directories into the container. Instead, it mounts directories already existing in the container environment onto another path in the container environment.
  • $(APP_DATA) basically expands to /iox_data/appdata - the automatically-created directory in the container environment where everything copied in via "app-hosting data appid APP copy ..." goes.

To get externally configured data to appear in your container, let's say you want to create your own "/etc/group" file in the container, you would first copy the file into the container:

app-hosting copy appid APP copy flash:/my-app/group /etc/group

This puts the "group" file into "/iox_data/appdata/etc/group".  You then need to use the -v option to remount the file into the desired path in the container in the app-hosting config:

run-opts 30 "-v $(APP_DATA)/etc/group:/etc/group"

And when the container is started, the file from your flash drive appears in the container under the path "/etc/group".