Device Agent - Docker Volume Mapping

My Provisioning Configuration, device.yml is on the host at /root/flowfuseDeviceAgent.device.yml

My docker compose is as copied from the docs.
The container fails to start with error: Invalid config file ‘/opt/flowforge-device/device.yml’: Failed to parse config file: Error: EISDIR: illegal operation on a directory, read’.

From this stackoverflow thread it seams if a file is mounted that doesn’t already exist in the container it is defaulted to a dir.

docker - How to mount a single file in a volume - Stack Overflow

version: ‘3.9’

image: flowforge/device-agent:latest
- “1880:1880”
- /root/flowfuseDeviceAgent/device.yml:/opt/flowforge-device/device.yml

the /root/flowfuseDeviceAgent/device.yml must exist even as an empty file before bringing up the docker compose file else docker will create a directory with that name.

Hi Ben,

It does exist. I downloaded it and copied over from the device provisioning on flowfuse to the docker host.

Testing1 is my docker host

root@Testing1:~/flowfuseDeviceAgent# pwd
root@Testing1:~/flowfuseDeviceAgent# cat device.yml


provisioningName: defaultDeviceProvisioning
provisioningTeam: *****
provisioningToken: *****
forgeURL: *****

And you did a docker compose down and a docker compose up after copying the file over? And you still get the same error?

I’m using portainer but I have done stop stack and start stack.
Just did it again to check, same error

Please run the following command docker ps to get the container name for the device agent container then run docker inspect [device-agent-container-name]

The container name should be [something]_device.

I want to double check what it has mounted where.

The container doesn’t show up on docker ps . In portainer it shows as exited.

Sorry, as it’s stopped you probably need to run docker ps -a

But the inspect command will be docker inspect nodereddeviceagent-device-1

Thanks, doesn’t appear with ‘docker ps -a’ either

OK, then we need to take portainer out of the mix, because it’s REALLY not helping here.

In the same directory as the docker-compose.yml file run the following commands:

  • docker compose up
  • Assuming it crashes, docker ps -a
  • docker inspect [something]-device-1

The nodereddeviceagent will probably get swapped for testing1- if it’s in the same directory as the device.yml file

1 Like

It must be something to do with portainer.
Created the exact same, copy paste, docker compose. Ran docker compose up and it seams to be working.

All I can suggest is to check the file ownership such that which ever user portainer is running as can access the device.yml file.

But I don’t use portainer so can’t really suggest anything else.

I won’t be using portainer long term, I was just using it as a test. The plan is to create an ansible role that will deploy the device agent whenever we configure a new server.

Thanks for the help :+1:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.