简体   繁体   English

在 docker 容器中使用创建的用户连接到创建的数据库

[英]Connect to created database with created user in a docker container

i'm trying to connect to a postgre database which is inside a docker container.我正在尝试连接到 docker 容器内的 postgre 数据库。 I´m creating the docker container with following command:我正在使用以下命令创建 docker 容器:

docker run --name prodcoc -p 5432:5432 -e POSTGRES_USER=testuser -e POSTGRES_PASSWORD=test -e POSTGRES_DB=testDB postgres

在此处输入图像描述

After the container is running I want to connect to the created database with the created user, but that seems not possible.容器运行后,我想用创建的用户连接到创建的数据库,但这似乎是不可能的。 Why can't I connect to the database which I'm creating with the enviroment variables?为什么我无法连接到使用环境变量创建的数据库?

在此处输入图像描述

The solution for my problem was to uninstall the local PostgreSql instance.我的问题的解决方案是卸载本地 PostgreSql 实例。 I don´t know why I installed it but removing it solved my problem.我不知道为什么要安装它,但删除它解决了我的问题。 In windows this can be done in the Settings.在 windows 中,这可以在设置中完成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM