Skip to content

DB, User not craeted using postgres docker-compose #285

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
veris-neerajdhiman opened this issue May 16, 2017 · 2 comments
Closed

DB, User not craeted using postgres docker-compose #285

veris-neerajdhiman opened this issue May 16, 2017 · 2 comments

Comments

@veris-neerajdhiman
Copy link

veris-neerajdhiman commented May 16, 2017

  • I was setting up my django project and postgres but everytime I was getting this error role doesn't exists or Db doesn't exists

  • So when I only tried to setup postgres and see if postgres is creating user and db correctly, but it wasn't

  • Here is my docker compose file :

version: "3"
services:
  templates_db:
    image: postgres:9.6
    ports:
     - "5432:5432"
    environment:
      - POSTGRES_USER=my_user
      - POSTGRES_PASSWORD=my_pass
      - POSTGRES_DB=my_db
    volumes:
      - ./data/postgres:/var/lib/postgresql/data
  • I ran my compose file using docker-compose up --build and got below logs
templates_db_1  | LOG:  database system was interrupted; last known up at 2017-05-16 05:48:39 UTC
templates_db_1  | LOG:  database system was not properly shut down; automatic recovery in progress
templates_db_1  | LOG:  invalid record length at 0/14F0080: wanted 24, got 0
templates_db_1  | LOG:  redo is not required
templates_db_1  | LOG:  MultiXact member wraparound protections are now enabled
templates_db_1  | LOG:  database system is ready to accept connections
templates_db_1  | LOG:  autovacuum launcher started
  • When I logged into postgres shell as
# su - postgres
$ psql
postgres=# \l

it didn't had the db I mentioned in compose file my_db

@veris-neerajdhiman veris-neerajdhiman changed the title DB, User not craeted using postgres dopcker image DB, User not craeted using postgres docker-compose May 16, 2017
@veris-neerajdhiman
Copy link
Author

It was permission error , as soon as I mentioned complete path in volumes

From :

volumes:
      - ./data/postgres:/var/lib/postgresql/data

To :

volumes:
      - /home/--path-to-folder/data/postgres:/var/lib/postgresql/data

Issue was resolved.

I am not closing this issue, If moderator think this was the right way, he can close the issue :)

@yosifkit
Copy link
Member

Not sure why a full path was required; 😕 the relative path works for docker compose (relative to the compose file).

Linking my other comment in case it helps explain what could've happened: #203 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants