Open dantownsend opened 6 days ago
@dantownsend I didn't understand how to add sensitive information as ENV
to Dockerfile
. For DB_PORT
that's fine (but maybe user run on different port and that can easily change in .env
file and run thru docker-compose
), but what about DB_USERNAME
, DB_PASSWORD
etc? If the user do not use docker-compose
, I find it useful to only run sensitive information with the Docker
cli as in this comment.
Docker also has SECRETS, but we can add secrets only via the command line?
@sinisaos When running a container in production, all of the platforms for running containers (e.g. Kubernetes, Amazon ECS) let you inject secrets as environment variables in some way. These secrets are for Docker Swarm, just one way of running containers in production. I wouldn't concern yourself with these.
So I wouldn't worry about it. From our perspective, secrets are just environment variables, like any others. If running it locally, then you can pass the secrets in via the command line like docker run piccolo_admin -e DB_PASSWORD=abc123
.
@dantownsend I see. Thanks for explanation. I'm sorry, but I've never had a chance to get a job as a professional developer so I don't know how things really work in real production environments, so I'll leave it up to you if that's not a problem. Thanks.
@sinisaos No problem - you've done a great job. I've been really into Docker for a super long time, which is why I'm mentioning these things, but it's mostly small details.
@dantownsend Great. Thanks
There is an example .env file, but it's best define the environment variables in the Dockerfile too. They can have default values.
For example