Docker - Unable to access postgres DB

Multi tool use
Docker - Unable to access postgres DB
im trying to setup NextCloud on Postgres with Docker but im unable to access/reach the postgress container from the nextcloud setup page.
Here is my setup:
docker network create --driver bridge nextcloud
docker run -p 127.0.0.1:5432:5432
--name postgres
--link cloud.mydomain.com
--net=nextcloud
-e POSTGRES_PASSWORD=supersecretpass123
-e POSTGRES_USER=nextcloud
-e POSTGRES_DB=nextcloud
-v postgres-data:/var/lib/postgresql/data
-d postgres
docker run -d -p 127.0.0.1:8080:80
--name="cloud.mydomain.com"
-e VIRTUAL_HOST=cloud.mydomain.com
-v nextcloud:/var/www/html
--net=nextcloud
nextcloud
docker run -d -p 80:80 -p 443:443 --name="cloud.mydomain.com-proxy"
--net=nextcloud
-v /srv/gitlab:/etc/nginx/vhost.d:ro
-v /root/certs:/etc/nginx/certs
-v /var/run/docker.sock:/tmp/docker.sock:ro
--restart always
jwilder/nginx-proxy:latest
Any Suggestion?
1 Answer
1
You need to invert the link, add the --link postgres
to cloud.mydomain.com:
--link postgres
docker run -d -p 127.0.0.1:8080:80
--name="cloud.mydomain.com"
--link postgres
-e VIRTUAL_HOST=cloud.mydomain.com
-v nextcloud:/var/www/html
--net=nextcloud
nextcloud
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.