docker compose problem

137 views
Skip to first unread message

Rj He

unread,
Dec 2, 2019, 12:20:27 PM12/2/19
to xnat_discussion
Hi, all,

I am trying docker compose on XNAT, and got messages as follow, what should I do to fix it?, thanks! Renjie:

PS C:\Users\rhe1> cd c:\xnatdockercompose
PS C:\xnatdockercompose> docker-compose up -d
Starting xnatdockercompose_xnat-db_1 ... done
Starting xnatdockercompose_xnat-web_1 ... done
Starting xnatdockercompose_xnat-nginx_1 ... done
PS C:\xnatdockercompose> docker-compose logs -f --tail=20 xnat-web
Attaching to xnatdockercompose_xnat-web_1
xnat-web_1    | psql: could not translate host name "xnat-db" to address: Name does not resolve
xnat-web_1    | Postgres is unavailable - sleeping
xnat-web_1    | psql: could not translate host name "xnat-db" to address: Name does not resolve
xnat-web_1    | Postgres is unavailable - sleeping
xnat-web_1    | psql: could not translate host name "xnat-db" to address: Name does not resolve
xnat-web_1    | Postgres is unavailable - sleeping
xnat-web_1    | psql: could not translate host name "xnat-db" to address: Name does not resolve
xnat-web_1    | Postgres is unavailable - sleeping
xnat-web_1    | psql: could not translate host name "xnat-db" to address: Name does not resolve
xnat-web_1    | Postgres is unavailable - sleeping
xnat-web_1    | psql: could not translate host name "xnat-db" to address: Name does not resolve
xnat-web_1    | Postgres is unavailable - sleeping
xnat-web_1    | psql: could not translate host name "xnat-db" to address: Name does not resolve
xnat-web_1    | Postgres is unavailable - sleeping
xnat-web_1    | psql: could not translate host name "xnat-db" to address: Name does not resolve
xnat-web_1    | Postgres is unavailable - sleeping
xnat-web_1    | psql: could not translate host name "xnat-db" to address: Name does not resolve
xnat-web_1    | Postgres is unavailable - sleeping
xnat-web_1    | psql: could not translate host name "xnat-db" to address: Name does not resolve
xnat-web_1    | Postgres is unavailable - sleeping
xnat-web_1    | psql: could not translate host name "xnat-db" to address: Name does not resolve
xnat-web_1    | Postgres is unavailable - sleeping
xnat-web_1    | psql: could not translate host name "xnat-db" to address: Name does not resolve
xnat-web_1    | Postgres is unavailable - sleeping
xnat-web_1    | psql: could not translate host name "xnat-db" to address: Name does not resolve
xnat-web_1    | Postgres is unavailable - sleeping
xnat-web_1    | psql: could not translate host name "xnat-db" to address: Name does not resolve
xnat-web_1    | Postgres is unavailable - sleeping
xnat-web_1    | psql: could not translate host name "xnat-db" to address: Name does not resolve
xnat-web_1    | Postgres is unavailable - sleeping
xnat-web_1    | psql: could not translate host name "xnat-db" to address: Name does not resolve
xnat-web_1    | Postgres is unavailable - sleeping
xnat-web_1    | psql: could not translate host name "xnat-db" to address: Name does not resolve
xnat-web_1    | Postgres is unavailable - sleeping
xnat-web_1    | psql: could not translate host name "xnat-db" to address: Name does not resolve
xnat-web_1    | Postgres is unavailable - sleeping
xnat-web_1    | psql: could not translate host name "xnat-db" to address: Name does not resolve
xnat-web_1    | Postgres is unavailable - sleeping
ERROR: Aborting.
PS C:\xnatdockercompose> docker-compose logs -f --tail=20 xnat-web
Attaching to xnatdockercompose_xnat-web_1
xnat-web_1    | psql: could not translate host name "xnat-db" to address: Name does not resolve
xnat-web_1    | Postgres is unavailable - sleeping
xnat-web_1    | psql: could not translate host name "xnat-db" to address: Name does not resolve
xnat-web_1    | Postgres is unavailable - sleeping
xnat-web_1    | psql: could not translate host name "xnat-db" to address: Name does not resolve
xnat-web_1    | Postgres is unavailable - sleeping
xnat-web_1    | psql: could not translate host name "xnat-db" to address: Name does not resolve
xnat-web_1    | Postgres is unavailable - sleeping
xnat-web_1    | psql: could not translate host name "xnat-db" to address: Name does not resolve
xnat-web_1    | Postgres is unavailable - sleeping
xnat-web_1    | psql: could not translate host name "xnat-db" to address: Name does not resolve
xnat-web_1    | Postgres is unavailable - sleeping
xnat-web_1    | psql: could not translate host name "xnat-db" to address: Name does not resolve
xnat-web_1    | Postgres is unavailable - sleeping
xnat-web_1    | psql: could not translate host name "xnat-db" to address: Name does not resolve
xnat-web_1    | Postgres is unavailable - sleeping
xnat-web_1    | psql: could not translate host name "xnat-db" to address: Name does not resolve
xnat-web_1    | Postgres is unavailable - sleeping
xnat-web_1    | psql: could not translate host name "xnat-db" to address: Name does not resolve
xnat-web_1    | Postgres is unavailable - sleeping
xnat-web_1    | psql: could not translate host name "xnat-db" to address: Name does not resolve
xnat-web_1    | Postgres is unavailable - sleeping
xnat-web_1    | psql: could not translate host name "xnat-db" to address: Name does not resolve
xnat-web_1    | Postgres is unavailable - sleeping
xnat-web_1    | psql: could not translate host name "xnat-db" to address: Name does not resolve
xnat-web_1    | Postgres is unavailable - sleeping
ERROR: Aborting.

Rj He

unread,
Dec 2, 2019, 2:04:41 PM12/2/19
to xnat_discussion

Tried PS C:\xnatdockercompose> docker-compose up, got:


xnat-db_1     | FATAL:  data directory "/var/lib/postgresql/data" has wrong ownership
xnat-db_1     | HINT:  The server must be started by the user that owns the data directory.

Kelsey

unread,
Dec 2, 2019, 2:38:33 PM12/2/19
to xnat_discussion
Hi Rj,

Sorry you are having trouble with xnat-docker-compose.  Are you using the master branch from https://github.com/NrgXnat/xnat-docker-compose?

The message "xnat-web_1    | Postgres is unavailable - sleeping" is normal, because the xnat-web container waits for postgres to fully start before starting its Tomcat process.  The "xnat-web_1    | psql: could not translate host name "xnat-db" to address: Name does not resolve" message, however indicates that the postgres container either hasn't been defined or can't be found on the default Docker network.

Assuming you have no data loaded into the system, I would try:
ensure all containers are stoped (docker ps -> docker kill CONTAINER_ID), 
and clone the above repo to an empty local directory owned by your user.

$ docker-compose up

Let me know how that works.

Thanks,
Matt

Rj He

unread,
Dec 2, 2019, 3:07:57 PM12/2/19
to xnat_discussion

Hi, Matt,


Thank you for the response, I did clone the repos as you indicated, and got:

xnat-db_1     | FATAL:  data directory "/var/lib/postgresql/data" has wrong ownership
xnat-db_1     | HINT:  The server must be started by the user that owns the data directory.

xnat-web_1    | psql: could not translate host name "xnat-db" to address: Name does not resolve
xnat-web_1    | Postgres is unavailable - sleeping
xnatdockercompose_xnat-db_1 exited with code 1

xnat-web_1    | psql: could not translate host name "xnat-db" to address: Name does not resolve
xnat-web_1    | Postgres is unavailable - sleeping

Kelsey

unread,
Dec 2, 2019, 3:21:21 PM12/2/19
to xnat_discussion
The directory "/vara/lib/postgresql/data" inside of your running postgres container corresponds to the "./postgres-data" directory on your docker host.  You might try 1. Checking permissions on ./postgres-data to be sure it is fully accessible. 2. deleting the postgres-data directory (assuming this is an empty XNAT) 2. Recreating the postgres-data directory with read/write/execute permissions for the docker user.

Rj He

unread,
Dec 2, 2019, 3:26:30 PM12/2/19
to xnat_discussion

I have tried what you indicated 1&2 and will try 3. Thank you!

Renjie

Kelsey

unread,
Dec 2, 2019, 3:32:08 PM12/2/19
to xnat_discussion
Hi Renjie,
  Sorry, I missed that you were running this on Docker for Windows.  You might find some answers in these threads, concerning "permissions errors when mounting a host path"


It seems to describe the issue you're seeing.

Best,
Matt

Rj He

unread,
Dec 2, 2019, 3:41:43 PM12/2/19
to xnat_discussion


Hi, Matt,

Thanks for the links.

I made postgre working by Docker (win10)->settings->shared drives->reset credentials,

However, now I got the message as:


Creating xnatdockercompose_xnat-db_1 ... done
Creating xnatdockercompose_xnat-web_1 ... done
Creating xnatdockercompose_xnat-nginx_1 ... done

PS C:\xnatdockercompose> docker-compose logs -f --tail=20 xnat-web
Attaching to xnatdockercompose_xnat-web_1
xnat-web_1    | psql: could not connect to server: Connection refused
xnat-web_1    |         Is the server running on host "xnat-db" (172.24.0.2) and accepting
xnat-web_1    |         TCP/IP connections on port 5432?

xnat-web_1    | Postgres is unavailable - sleeping
xnat-web_1    | psql: could not connect to server: Connection refused
xnat-web_1    |         Is the server running on host "xnat-db" (172.24.0.2) and accepting
xnat-web_1    |         TCP/IP connections on port 5432?

xnat-web_1    | Postgres is unavailable - sleeping
xnat-web_1    | psql: could not connect to server: Connection refused
xnat-web_1    |         Is the server running on host "xnat-db" (172.24.0.2) and accepting
xnat-web_1    |         TCP/IP connections on port 5432?

xnat-web_1    | Postgres is unavailable - sleeping
xnat-web_1    | psql: could not connect to server: Connection refused
xnat-web_1    |         Is the server running on host "xnat-db" (172.24.0.2) and accepting
xnat-web_1    |         TCP/IP connections on port 5432?

xnat-web_1    | Postgres is unavailable - sleeping
xnat-web_1    | psql: could not connect to server: Connection refused
xnat-web_1    |         Is the server running on host "xnat-db" (172.24.0.2) and accepting
xnat-web_1    |         TCP/IP connections on port 5432?

xnat-web_1    | Postgres is unavailable - sleeping
xnat-web_1    | psql: could not translate host name "xnat-db" to address: Name does not resolve
xnat-web_1    | Postgres is unavailable - sleeping
ERROR: Aborting.
PS C:\xnatdockercompose>

Rj He

unread,
Dec 3, 2019, 4:26:51 PM12/3/19
to xnat_discussion
Hi, Matt,


I did what you suggested, still got following, what exactly the ownership should belong to? currently I used 'takeown /f "c:\folder\" /r' to change ownership recursively all folders/subfolders in 'xnatdockercompose' to my windows userID:



PS C:\xnatdockercompose> docker-compose down
Removing xnatdockercompose_xnat-nginx_1 ... done
Removing xnatdockercompose_xnat-web_1   ... done
Removing xnatdockercompose_xnat-db_1    ... done
Removing network xnatdockercompose_default

PS C:\xnatdockercompose> docker-compose up
Creating network "xnatdockercompose_default" with the default driver

Creating xnatdockercompose_xnat-db_1 ... done
Creating xnatdockercompose_xnat-web_1 ... done
Creating xnatdockercompose_xnat-nginx_1 ... done
Attaching to xnatdockercompose_xnat-db_1, xnatdockercompose_xnat-web_1, xnatdockercompose_xnat-nginx_1
xnat-db_1     |
xnat-db_1     | PostgreSQL Database directory appears to contain a database; Skipping initialization
xnat-db_1     |

xnat-db_1     | FATAL:  data directory "/var/lib/postgresql/data" has wrong ownership
xnat-db_1     | HINT:  The server must be started by the user that owns the data directory.
xnat-web_1    | psql: could not translate host name "xnat-db" to address: Name does not resolve
xnat-web_1    | Postgres is unavailable - sleeping
xnatdockercompose_xnat-db_1 exited with code 1
xnat-web_1    | psql: could not translate host name "xnat-db" to address: Name does not resolve
xnat-web_1    | Postgres is unavailable - sleeping
Gracefully stopping... (press Ctrl+C again to force)
Stopping xnatdockercompose_xnat-nginx_1 ... done
Stopping xnatdockercompose_xnat-web_1   ... done
PS C:\xnatdockercompose> docker container ls -a
CONTAINER ID        IMAGE                          COMMAND                  CREATED             STATUS                        PORTS               NAMES
3599c7bace03        xnatdockercompose_xnat-nginx   "nginx -g 'daemon of…"   50 seconds ago      Exited (0) 41 seconds ago                         xnatdockercompose_xnat-nginx_1
f58be129dd3b        xnatdockercompose_xnat-web     "wait-for-postgres.s…"   53 seconds ago      Exited (137) 30 seconds ago                       xnatdockercompose_xnat-web_1
478e274aec85        xnatdockercompose_xnat-db      "docker-entrypoint.s…"   55 seconds ago      Exited (1) 52 seconds ago                         xnatdockercompose_xnat-db_1
PS C:\xnatdockercompose>







On Monday, December 2, 2019 at 2:21:21 PM UTC-6, Kelsey wrote:
Reply all
Reply to author
Forward
0 new messages