Having Issue using Postgresql as database for Rails container

Keywords: Ruby - Linux - How to - Other
Description:
Hi,

I want use Postgresql as my Rails app database but when I run docker-compose up, I get

myapp_1       | mariadb: forward host lookup failed: Unknown host
myapp_1       | Trying to connect to mariadb at . Attempt 28.
myapp_1       | mariadb: forward host lookup failed: Unknown host
myapp_1       | Trying to connect to mariadb at . Attempt 29.
myapp_1       | mariadb: forward host lookup failed: Unknown host
myapp_1       | Error: Couldn't connect to mariadb.
myapp_myapp_1 exited with code 1

Here is what my docker-compose.yml file looks like:

version: '2'

services:
  postgresql:
    image: 'bitnami/postgresql:9.6.6-r0'
    environment:
      - ALLOW_EMPTY_PASSWORD=yes

  myapp:
    tty: true
    stdin_open: true 
    image: bitnami/rails:5.1.5-r0
    environment:
      - DATABASE_URL=postgresql 
    depends_on:
      - postgresql
    ports:
      - 3000:3000
    volumes:
      - .:/app

Am not sure if the line - DATABASE_URL=postgresql is correct though.
Any idea about this?

Hi,

I am sorry but unfortunately, at this time the Rails container only supports MariaDB as database.

Best regards,
Carlos R. Hernández

Thank you for letting me know.

I think it’d be nice to mention this on the README file.

1 Like

Hi,

Thanks for the suggestion, I move it internally. If you have any other questions, please do not hesitate to let us know.

Best regards,
Carlos R. Hernández

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.