All you have to do is specify the file in the compose file -
https://docs.docker.com/compos…ile/05-services/#env_file
env_file:
- web-variables.env
Only thing to note is that it must be a relative path. So, I would recommend putting the file in the base path of your sharedfolder that your compose file is in. Then you would reference it with something like this:
env_file:
- ../web-variables.env
I do several test and do not works as described or I do something bad.
I copy my Variables.env to root of compose:
I use this yaml file for webDAV as example:
- $Descargas:/data
# user and password
# - $HOME/docker/webdav/htpasswd:/etc/nginx/htpasswd:ro
env_file:
- ../Variables.env
environment:
- WEBDAV_USERNAME=$User
- WEBDAV_PASSWORD=$Password
- SERVER_NAMES=adns.$URL
- CLIENT_MAX_BODY_SIZE=5G # must end with M(egabytes) or G(igabytes)
- TIMEOUTS_S=1200 # these are seconds
- PUID=$PUID
- PGID=$PGID
- TZ=$TZ
ports:
- 8881:80
restart: unless-stopped
Alles anzeigen
And check on compose pluging, that is the error:
Failed to execute command 'export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin; export LANG=C.UTF-8; export LANGUAGE=; docker-compose --file '/srv/dev-disk-by-uuid-3a76d173-5a39-46ab-b34d-369e96f50cf9/Compose/Webdav/Webdav.yml' --env-file '/srv/dev-disk-by-uuid-3a76d173-5a39-46ab-b34d-369e96f50cf9/Compose/Webdav/Webdav.env' config 2>&1': time="2023-07-13T09:00:54+02:00" level=warning msg="The \"Descargas\" variable is not set. Defaulting to a blank string."
time="2023-07-13T09:00:54+02:00" level=warning msg="The \"User\" variable is not set. Defaulting to a blank string."
time="2023-07-13T09:00:54+02:00" level=warning msg="The \"Password\" variable is not set. Defaulting to a blank string."
time="2023-07-13T09:00:54+02:00" level=warning msg="The \"URL\" variable is not set. Defaulting to a blank string."
time="2023-07-13T09:00:54+02:00" level=warning msg="The \"PUID\" variable is not set. Defaulting to a blank string."
time="2023-07-13T09:00:54+02:00" level=warning msg="The \"PGID\" variable is not set. Defaulting to a blank string."
time="2023-07-13T09:00:54+02:00" level=warning msg="The \"TZ\" variable is not set. Defaulting to a blank string."
1 error(s) decoding:
* error decoding 'volumes[0]': invalid spec: :/data: empty section between colons
OMV\ExecException: Failed to execute command 'export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin; export LANG=C.UTF-8; export LANGUAGE=; docker-compose --file '/srv/dev-disk-by-uuid-3a76d173-5a39-46ab-b34d-369e96f50cf9/Compose/Webdav/Webdav.yml' --env-file '/srv/dev-disk-by-uuid-3a76d173-5a39-46ab-b34d-369e96f50cf9/Compose/Webdav/Webdav.env' config 2>&1': time="2023-07-13T09:00:54+02:00" level=warning msg="The \"Descargas\" variable is not set. Defaulting to a blank string."
time="2023-07-13T09:00:54+02:00" level=warning msg="The \"User\" variable is not set. Defaulting to a blank string."
time="2023-07-13T09:00:54+02:00" level=warning msg="The \"Password\" variable is not set. Defaulting to a blank string."
time="2023-07-13T09:00:54+02:00" level=warning msg="The \"URL\" variable is not set. Defaulting to a blank string."
time="2023-07-13T09:00:54+02:00" level=warning msg="The \"PUID\" variable is not set. Defaulting to a blank string."
time="2023-07-13T09:00:54+02:00" level=warning msg="The \"PGID\" variable is not set. Defaulting to a blank string."
time="2023-07-13T09:00:54+02:00" level=warning msg="The \"TZ\" variable is not set. Defaulting to a blank string."
1 error(s) decoding:
* error decoding 'volumes[0]': invalid spec: :/data: empty section between colons in /usr/share/openmediavault/engined/rpc/compose.inc:566
Stack trace:
#0 /usr/share/php/openmediavault/rpc/serviceabstract.inc(619): OMVRpcServiceCompose->{closure}('/tmp/bgstatusFl...', '/tmp/bgoutputyL...')
#1 /usr/share/openmediavault/engined/rpc/compose.inc(569): OMV\Rpc\ServiceAbstract->execBgProc(Object(Closure))
#2 [internal function]: OMVRpcServiceCompose->doCommand(Array, Array)
#3 /usr/share/php/openmediavault/rpc/serviceabstract.inc(123): call_user_func_array(Array, Array)
#4 /usr/share/php/openmediavault/rpc/rpc.inc(86): OMV\Rpc\ServiceAbstract->callMethod('doCommand', Array, Array)
#5 /usr/sbin/omv-engined(537): OMV\Rpc\Rpc::call('Compose', 'doCommand', Array, Array, 1)
#6 {main}
Alles anzeigen
--env-file '/srv/dev-disk-by-uuid-3a76d173-5a39-46ab-b34d-369e96f50cf9/Compose/Webdav/Webdav.env' is of course blank, and
'/srv/dev-disk-by-uuid-3a76d173-5a39-46ab-b34d-369e96f50cf9/Compose/Variables.env' is not used.
see my webDAV.yaml file, that I refer in this way:
env_file path for docker-compose extend relative to base file
I have a two docker-compose files, one is ./libbeat/docker-compose.yml and one in ./testing/environments/base.yml The file in libbeat has the following config…
forums.docker.com
Not sure where to put my Variables.env file for use on all of my dockers.
omv 7.0.5-1 sandworm | 64 bit | 6.5 proxmox kernel
plugins :: omvextrasorg 7.0 | kvm 7.0.11 | compose 7.1.3 | k8s 7.1.0-3 | cputemp 7.0 | mergerfs 7.0.3
omv-extras.org plugins source code and issue tracker -
github
-
changelogs
Please try
ctrl-shift-R
and read
this
before posting a question.
Please put your OMV system details in your signature.
Please don't PM for support... Too many PMs!
omv 7.0.5-1 sandworm | 64 bit | 6.5 proxmox kernel
plugins :: omvextrasorg 7.0 | kvm 7.0.11 | compose 7.1.3 | k8s 7.1.0-3 | cputemp 7.0 | mergerfs 7.0.3
omv-extras.org plugins source code and issue tracker -
github
-
changelogs
Please try
ctrl-shift-R
and read
this
before posting a question.
Please put your OMV system details in your signature.
Please don't PM for support... Too many PMs!
This change is in the repo now. The icon on the Files tab that looks like paper with a star on it is the global.env editor
The enabled checkbox on the global.env editor determines if global.env exists. If you disable it, the file will be deleted but environment variables will stay in the database. When you enable it, the file will be recreated.
Does this work the same as compose yml files, you can only edit from within plugin?
omv 7.0.5-1 sandworm | 64 bit | 6.5 proxmox kernel
plugins :: omvextrasorg 7.0 | kvm 7.0.11 | compose 7.1.3 | k8s 7.1.0-3 | cputemp 7.0 | mergerfs 7.0.3
omv-extras.org plugins source code and issue tracker -
github
-
changelogs
Please try
ctrl-shift-R
and read
this
before posting a question.
Please put your OMV system details in your signature.
Please don't PM for support... Too many PMs!
omv 7.0.5-1 sandworm | 64 bit | 6.5 proxmox kernel
plugins :: omvextrasorg 7.0 | kvm 7.0.11 | compose 7.1.3 | k8s 7.1.0-3 | cputemp 7.0 | mergerfs 7.0.3
omv-extras.org plugins source code and issue tracker -
github
-
changelogs
Please try
ctrl-shift-R
and read
this
before posting a question.
Please put your OMV system details in your signature.
Please don't PM for support... Too many PMs!
That is the OMV way. I don't have anyway to sync the database if you edit outside the plugin. Is there a reason to edit the file outside of the plugin?
Not really, apart from in vs-code I have a tab for 'global.env' open. But TBH I expect a global file is not going to be edited very often. Also in the compose files there is a warning, but not in 'global.env', just dotting i's and crossing t's.
This will not work. The plugin will overwrite it. You must copy & paste the variables from your file into the global env editor. If you don't, the next time you make a change in the plugin, it will overwrite your file.
Sorry, I really think that I do it, but my memory is really bad, thanks to remember the correct way.
Also in the compose files there is a warning, but not in 'global.env', just dotting i's and crossing t's.
I didn't add the auto generated header to the global.env file for the same reason I removed it from the regular .env file creation for the Files tab - it causes issues for some things. I would have to find the post with an example of how it causes problems. It was reported by a couple of users. But you shouldn't rely on that header. If a file is maintained by something in OMV, you are most likely not able to make changes from the command line.
omv 7.0.5-1 sandworm | 64 bit | 6.5 proxmox kernel
plugins :: omvextrasorg 7.0 | kvm 7.0.11 | compose 7.1.3 | k8s 7.1.0-3 | cputemp 7.0 | mergerfs 7.0.3
omv-extras.org plugins source code and issue tracker -
github
-
changelogs
Please try
ctrl-shift-R
and read
this
before posting a question.
Please put your OMV system details in your signature.
Please don't PM for support... Too many PMs!
If people use it how I think they will, they will be editing every time they add a container/compose.
I think this is how I intend to use this feature - For 'global.env' I've setup a few variables i.e. PGUD that I use often, plus folders I use regularly i.e media, downloads etc. Then if I wanted something like passwords for cameras, I will then add that to the container.env file.
But as with most things PC related there is rarely just one way to do it
As long as it works for me, I'm a happy bunny.
I didn't add the auto generated header to the global.env file for the same reason I removed it from the regular .env file creation for the Files tab - it causes issues for some things. I would have to find the post with an example of how it causes problems. It was reported by a couple of users. But you shouldn't rely on that header. If a file is maintained by something in OMV, you are most likely not able to make changes from the command line.
OK, I'm getting used to hearing 'That is the OMV way.'
Sie haben noch kein Benutzerkonto auf unserer Seite?
Registrieren Sie sich kostenlos
und nehmen Sie an unserer Community teil!
Benutzerkonto erstellen
Anmelden
Um die Webseite zu verbessern und maßgeschneiderte Werbung anzubieten werden Cookies verwendet. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen.
Weitere Informationen
Schließen