encrypt .env variables to be used in docker-compose

119 views Asked by At

I'm following a tutorial to set up elasticsearch with docker-compose. The tutorial has a .env file with something like:

ELASTIC_USER=changeme
ELASTIC_PASS=changeme

Does docker-compose have a way to encrypt the value of variables that have been loaded from a .env file? I've seen some SO questions and blogs from 10 years ago saying that this is not possible, or that you would need to use docker swarm to leverage the ability to encrypt values loaded from a .env file.

It is now the year 2023, about 10 years since those last posts. Is there a modern practice for encrypting secrets to be used in docker-compose?


NOTE: elasticsearch itself does have keystores for this purpose, but I've been running into technical complications with them when used in containerized environment. I am continuing to resolve these complications, but wanted to see if docker-compose offers me any alternatives.

0

There are 0 answers