Docker Image not respecting ENV variable for Postgres config

Umbrae's Avatar


16 Jun, 2020 05:43 PM

When launching a docker container using postgres the Environment Variables appear to not be respected and the instance is trying to connect to localhost with default credentials.

Docker Logs:
Couldn't create database for {"host"=>"localhost", "adapter"=>"postgresql", "encoding"=>"unicode", "database"=>"arachni_production", "pool"=>50, "username"=>"arachni", "password"=>"secret"}
rake aborted!
PG::ConnectionBad: could not connect to server: Connection refused
Is the server running on host "localhost" ( and accepting TCP/IP connections on port 5432? could not connect to server: Cannot assign requested address
Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432?

From Docker-Compose:
arachni: container_name: arachni image: arachni/arachni:latest environment: DB_ADAPTER: postgresql DB_HOST: arachni_postgresdb DB_NAME: arachnidb DB_USER: arachnidb DB_PASS: PASSWORD ports: - 222:22 - 7331:7331 - 9292:9292

  1. 1 Posted by Umbrae on 16 Jun, 2020 05:54 PM

    Umbrae's Avatar

    As FYI:

    This is my current docker project. I can get it working with the default internal DB, so the postgres code is commented out.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac