Search code examples
dockerdocker-secrets

Why should I use Docker Secrets?


For the last few months I've managed passwords for my docker containers by putting them in the ENV variables.

Example:

web:
  environment:
    - PASSWORD=123456

Then I bumped into Docker Secrets. So my questions are:

  1. Which are the reasons why I should use them?
  2. Are they more secure? How?
  3. Can you provide a simple example to show their functionalities?

Solution

  • It depends on a use case.

    If you're running one application on your own machine for development that accesses just one secret, you don't need docker secrets.

    If you're running dozens of machines in production with a dozen of clustered services all requiring secrets for each other, you do need the secret management.

    Apart from security concern, it's just plain easier to have a standardized way of accessing, creating and removing your secrets.