Skip to content

Provide a better way to pass the password to the container #111

Closed
@bladnor

Description

@bladnor

I don't like setting the password with an environment variable because environment variables can be viewed with 'docker inspect'. Can you provide a way to pass the password by mounting a file to the container and read the password from that file?

For example something like this:
$cat secret
export POSTGRES_PASSWORD=mysecretpostgrespassword
$ sudo docker run -v $(pwd):/tmp --name some-postgres -d postgres

and then in docker-entrypoint.sh read/source the password from /tmp/secret .

Thank you

PS:
I tried to do something like this:
$sudo docker run -v $(pwd):/tmp --entrypoint /bin/bash --name some-postgres -d postgres "source /tmp/secret >> docker-entrypoint.sh"

but this resulted in:
/bin/bash: source /tmp/secret >> docker-entrypoint.sh: No such file or directory

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions