sharing value between containers

Hello everyone,

I’m trying to share value between 2 python files in 2 differents containers, the idea is to use “volume” so both .py can access the file. On .py will fill the .txt file and the other will read the .txt file. When I try to upload it there is an error: “Bind mounts are not allowed”. How can I fix it ? Am I using the containers in the right way ? Attached the folder that I try to flash, my dockercompose and the two dockerfile. Notice that in the folder “writer” and “reader” there is the python file and the docker file.

Thank you in advance for the help.


Still searching for help. Even short advice. If you can help me let me know.

Thank you.


Hello @Hugo thank you for your message.

Actually we don’t support bind mounts at balena (yet). You can read more about the docker-compose on balena here Multiple containers - Balena Documentation

My recommendation would be to copy these exact files on the image at the right location from the Dockerfile.

Let us know if this works for you!

Hello mpous,

Thank you for your help. Does it mean that I don’t use the “volume” and I just copy the file in the directory from the Dockerfile ? Is there any other way to share variable between containers that I have to try?

Hello @hugo, you can still use volumes (but not bind mounted) to share files among containers. See Multiple containers - Balena Documentation and also an example here of volumes being shared among various services: coral-audio-analysis/docker-compose.yml at master · balena-io-experimental/coral-audio-analysis · GitHub
Another way you could share variables or data is to use a database that has an API that each Python service can access. Redis is a popular choice for this use case, and has an easy API.
Redis with Python | Redis Documentation Center