我正在嘗試使用 docker 容器運行竹服務器并將其連接到在另一個容器上運行的 postgres db。首先,我運行 postgres db 并使用用戶 postgres 和密碼 postgres 創建一個名為竹的空資料庫。
這是一個顯示它有效的測驗,我可以連接到它

我運行這個命令從
然后我打開 localhost:8085 并生成一個許可證并達到這一點,我看到了這個錯誤
訪問資料庫時出錯:org.postgresql.util.PSQLException:連接到 localhost:5432 被拒絕。檢查主機名和埠是否正確以及 postmaster 是否接受 TCP/IP 連接。

問題是什么?
這是碼頭工人日志
C:\Users\aminb>docker logs 9e31ad6a773c
INFO:root:Generating /opt/atlassian/bamboo/conf/server.xml from template server.xml.j2
INFO:root:Generating /opt/atlassian/bamboo/atlassian-bamboo/WEB-INF/classes/seraph-config.xml from template seraph-config.xml.j2
INFO:root:Generating /opt/atlassian/bamboo/atlassian-bamboo/WEB-INF/classes/bamboo-init.properties from template bamboo-init.properties.j2
INFO:root:/var/atlassian/application-data/bamboo/bamboo.cfg.xml exists; skipping.
INFO:root:User is currently root. Will downgrade run user to bamboo
INFO:root:Running Bamboo with command '/opt/atlassian/bamboo/bin/start-bamboo.sh', arguments ['/opt/atlassian/bamboo/bin/start-bamboo.sh', '-fg']
Server startup logs are located in /opt/atlassian/bamboo/logs/catalina.out
Bamboo Data Center
Version : 8.2.1
If you encounter issues starting or stopping Bamboo Server, please see the Troubleshooting guide at https://confluence.atlassian.com/display/BAMBOO/Installing and upgrading Bamboo
Using BAMBOO_HOME: /var/atlassian/application-data/bamboo
NOTE: Picked up JDK_JAVA_OPTIONS: --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
10-Apr-2022 03:29:59.852 WARNING [main] org.apache.tomcat.util.digester.SetPropertiesRule.begin [SetPropertiesRule]{Server} Setting property 'port' to '' did not find a matching property.
10-Apr-2022 03:30:00.078 WARNING [main] org.apache.catalina.startup.SetAllPropertiesRule.begin [SetAllPropertiesRule]{Server/Service/Connector} Setting property 'proxyPort' to '' did not find a matching property.
10-Apr-2022 03:30:00.117 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The Apache Tomcat Native library which allows using OpenSSL was not found on the java.library.path: [/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib]
10-Apr-2022 03:30:00.142 INFO [main] org.apache.coyote.http11.AbstractHttp11Protocol.configureUpgradeProtocol The ["http-nio-8085"] connector has been configured to support HTTP upgrade to [h2c]
10-Apr-2022 03:30:00.143 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8085"]
10-Apr-2022 03:30:00.159 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 363 ms
10-Apr-2022 03:30:00.185 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
10-Apr-2022 03:30:00.185 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine: [Apache Tomcat/8.5.75]
10-Apr-2022 03:30:05.846 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console...
10-Apr-2022 03:30:08.657 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8085"]
10-Apr-2022 03:30:08.663 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
10-Apr-2022 03:30:08.681 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 8522 ms
uj5u.com熱心網友回復:
如果您沒有設定docker 的網路,它將使用bridge默認模式。
我認為問題在于您可能會使用而{containerName}:5432不是連接字串,因為這意味著您的網站容器而不是真實計算機,因此您無法通過它連接到資料庫。localhost:5432JDBClocalhost
jdbc:postgresql://bamboo-pg-db-container:5432/bamboo
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/457917.html
標籤:PostgreSQL 码头工人 竹子
