Currently I got a fairly big monolithic balena image which is using systemd to run various services. This works as expected, but it would be nice to split it up into several smaller containers.
The split up would create the following:
One-to-many containers which would contain data only ( not a named volume and not a bind volume )
One-to-many containers which would contain self-contained services
One container for the main application mounting data from data only containers
The main issue from these requirements are the data only container. The balena documentation states that the balena backend only supports a subset of the docker-compose version 2.1. This subset does not support volumes_from docker-compose field which seems to be the field to use in order to share data between containers.
I have done some named volume experiments based on the multicontainer-getting-started.
The experiments include named volumes which are mounted as show in:
Multi containers using named volumes for data sharing
`version: ‘2’
volumes:
fundata: {}
proxydata: {}
services:
proxy:
build: ./haproxy
depends_on:
- frontend
- data
ports:
- “80:80”
volumes:
- proxydata:/proxy:rw
data:
build: ./data
expose:
- “8080”
volumes:
- fundata:/usr:rw
frontend:
build: ./frontend
expose:
- “80”
volumes:
- fundata:/tmp/fundata:rw
- proxydata:/tmp/proxydata:rw`
Question:
Is named volumes show in the above docker-compose how data should be shared between containers? Unsure if this method introduce data race condition depending on which contain starts first. Additionally it seems the any data pointed to the named volume will be copied and not mounted. May be an issue for larger data amounts.
Is there any plan to support volumes_from?
Is there a more optimal way to perform data shared between multi containers?