Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

psql: could not translate host name "postgres" to address: Temporary failure in name resolution

i cloned from github a docker-mail repository "https://github.com/1it/docker-mail" and ran the docker-compose.yml. It created 6 containers and 6 images. Then i have created a Dockerfile with a basis Image from one of these 6 Images "dockermail_roundcube", to have only one Image which contains all services.

That are the created images from Github:

 dockermail_dovecot        latest              451da418d747        5 days ago          160MB
 dockermail_roundcube      latest              41b2a49d9233        5 days ago          346MB
 dockermail_postfixadmin   latest              b4e1db428c5c        5 days ago          276MB
 dockermail_postfix        latest              21e6c1321a4f        5 days ago          207MB
 dockermail_certs          latest              9fa00330df3e        5 days ago          140MB
 dockermail_postgres       latest              cdfa8642ac29        5 days ago          269MB

then i built an image from my Dockerfile:

FROM dockermail_roundcube:latest
MAINTAINER Siamak Mottaghian
#Postfix
ENV DOMAIN=trivadis.com
ENV MAILNAME=smtp.trivadis.com
ENV MY_NETWORKS=172.16.0.0/15-192.168.0.0/16
# Postgres
ENV LANG=en_US.utf8
ENV DB_NAME=mail
ENV USER_NAME=mail
ENV USER_PASSWD=eeheiThoh2mohjou
ENV POSTGRES_PASSWORD=oejoojo9eimeeloocuCogichoove4oho
ENV PG_PASSWD_FILE=postgres:5432:*:usrname:passwd
# Roundcube / Postfixadmin
ENV APACHE_RUN_USER=www-data
ENV APACHE_RUN_GROUP=www-data
ENV APACHE_LOG_DIR=/var/log/apache2
ENV APACHE_PID_FILE=/var/run/apache2.pid
ENV APACHE_RUN_DIR=/var/run/apache2
ENV APACHE_LOCK_DIR=/var/lock/apache2
ENV APACHE_LOG_DIR=/var/log/apache2
# Roundcube config
ENV DEFAULT_HOST=ssl://imap.trivadis.com
ENV DEFAULT_PORT=993
ENV SMTP_SERVER=tls://smtp.trivadis.com
ENV SMTP_PORT=587
ENV DES_KEY=angahth3ki7shaeTie7queibeSaeyugi 
### Postfixadmin
# Sample Admin passwd
# [email protected]
# example12345
EXPOSE 25 465 587 110 995 143 993 80 8080

After running the container:

docker run -d --name roundcube roundcube

i tried to open the roundcube client in browser but that is not possible.

and i get this Massage in my docker logs:

psql: could not translate host name "postgres" to address: Temporary failure in name resolution
Postgres is unavailable - sleeping

Can you guys help me to solve that issue!? THX

like image 538
guguli Avatar asked Dec 17 '25 13:12

guguli


1 Answers

There may be a workaround, but the most obvious solution is to use docker-compose. Docker compose will fire up both the postgres container and your server container. Docker compose will also create a network for both of these container, so you will be able to connect to them.

like image 82
Tarang Avatar answered Dec 20 '25 06:12

Tarang



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!