Is there a possibility to let Docker share the environment variables of containers that are linked with --volumes-from
at runtime, the same way it does with containers linked with --link
?
I'm using data-only containers for persistent data in my applications and I would like to check in the entrypoint script of my application container whether or not a data container was referenced at runtime and cancel if there is none.
My idea was checking whether or not the environment variable of the data container (containing the path of the exposed volume) was set, I was also planning on using its value at certain points in the script (e.g. setting the data directory of my application in its configuration files).
Is there any way to achieve this and if not what would be the next best way to do the things I described?
I found that docker inspect
returns all volumes-from
containers under HostConfig.VolumesFrom
. This does not completely solve the sharing problem since I would like to check for a fixed value (the environment variable's name) and not a container name and need the variable's value as well, but it's a start.