community icon indicating copy to clipboard operation
community copied to clipboard

file .env with docker secret

Open adouren opened this issue 3 years ago • 0 comments

Hello,

I put the passwords of an elastic stack in a ".env" file.

File .env:

ELASTIC_PASSWORD=elastic

elasticsearch: image: docker.elastic.co/elasticsearch/elasticsearch:7.16.3 env_file:

.env …

When executing the stack, it works very well and the environment variables are updated in the stack. stack is ok.

Now when I put this ".env" file in secret docker the environment variables are not updated.

.... secrets: elk_secret: file: .env

services: elasticsearch: image: docker.elastic.co/elasticsearch/elasticsearch:7.16.3 secrets:

elk_secret .... Is there a trick to be able to put the ".env" file in docker secret and have the stack environment variables updated.

docker version Client: Version: 18.03.1-ce API version: 1.37 Go version: go1.9.5 Git commit: 9ee9f40 Built: Thu Apr 26 07:17:14 2018 OS/Arch: linux/amd64 Experimental: false Orchestrator: swarm

Server: Engine: Version: 18.03.1-ce API version: 1.37 (minimum version 1.12) Go version: go1.9.5 Git commit: 9ee9f40 Built: Thu Apr 26 07:15:24 2018 OS/Arch: linux/amd64 Experimental: false

docker-compose version docker-compose version 1.21.2, build a133471 docker-py version: 3.3.0 CPython version: 3.6.5 OpenSSL version: OpenSSL 1.0.1t 3 May 2016

Best regard

Olivier

adouren avatar Apr 08 '22 13:04 adouren