Skip to content

User and DB were not created from environment variable arguments #453

@Bryksin

Description

@Bryksin

Hi

Having problem to set database name with database user, details are below:

Dockerfile:

FROM postgres:10.4-alpine

LABEL maintainer="Vadim Bryksin <removed_my_email_from_internet@gmail.com>"

HEALTHCHECK --interval=30s --timeout=15s CMD pg_isready -U postgres  || exit 1

Building docker:

docker build -t postgres_db . -f deployment\db\Dockerfile

Docker images:

REPOSITORY                 TAG                 IMAGE ID            CREATED             SIZE
postgres_db                latest              541471b4064f        5 seconds ago       39.5MB
postgres                   10.4-alpine         f298e9fa532e        6 days ago          39.5MB
docker4w/nsenter-dockerd   latest              cae870735e91        7 months ago        187kB

Running container with:

docker run -it --rm --name postgres_db -v db-data:/var/lib/postgresql/data -p 5432:5432 -e POSTGRES_DB=snippet_db -e POSTGRES_USER=snippet_user -e POSTGRES_PASSWORD=P@88w0rd postgres_db

Connecting trough Navicat UI tool:
Navicat User

Postgres output log:

2018-05-31 21:57:03.245 UTC [147] FATAL:  password authentication failed for user "snippet_user"
2018-05-31 21:57:03.245 UTC [147] DETAIL:  Role "snippet_user" does not exist.
        Connection matched pg_hba.conf line 95: "host all all all md5"

Changing user to default: postgres
Navicat DB

Postgres output log:

2018-05-31 22:00:07.921 UTC [195] FATAL:  database "snippet_db" does not exist

Changing to default DB:
Navicat Ok

Conclusion:
From all environment variables passed during the container execution was accepted only: POSTGRES_PASSWORD

Other variables: POSTGRES_USER and POSTGRES_DB were ignored!
Possibly relates to an already closed issue: #41

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionUsability question, not directly related to an error with the image

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions