我正在尝试在容器中启动工件,它似乎无法连接到我的postgres数据库。
我正在这样启动它:
docker run --network mynet --name artifactory -e JF_SHARED_DATABASE_DRIVER=org.postgresql.Driver -e JF_SHARED_DATABASE_URL="jdbc:postgresql://postgres:5432/artifactory" -e JF_SHARED_DATABASE_TYPE=postgresql -e JF_SHARED_DATABASE_HOST=postgres -e JF_SHARED_DATABASE_PORT=5432 -e JF_SHARED_DATABASE_USER=artifactory -e JF_SHARED_DATABASE_PASSWORD=password -p 9081:8081-i -t --rm docker.bintray.io/jfrog/artifactory-pro:7.10.2
将其输出如下:
Preparing to run Artifactory in Docker
Running as uid=1030(artifactory) gid=1030(artifactory)
Dockerfile for this image can found inside the container.
To view the Dockerfile: 'cat /docker/artifactory-pro/Dockerfile.artifactory'.
Resolved JF_SHARED_DATABASE_TYPE (postgresql) from environment variable
Resolved JF_SHARED_DATABASE_URL (jdbc:postgresql://postgres:5432/artifactory) from environment variable
Waiting for DB postgresql to be ready on postgres/5432 for 30 second
这应该不需要30秒,因此这是一个立即的危险信号。 然后在30多岁过期后,我看到了许多这样的内容:
2020-10-16T13:19:48.662Z [jfmd ] [INFO ] [75be6b93f5c12126] [database_bearer.go:100 ] [main ] - Connecting to (db config: {postgresql jdbc:postgresql://postgres:5432/artifactory}) [database]
2020-10-16T13:19:48.671Z [jfmd ] [WARN ] [75be6b93f5c12126] [jobs.go:92 ] [main ] - [RETRY] Initiating database connection: pq: no PostgreSQL user name specified in startup packet. Retrying in 1s ... (1/120) [database]
启动输出确认已设置:
JF_SHARED_NODE_NAME : da6d3e81a7c5
JF_SHARED_DATABASE_PORT : 5432
JF_SHARED_DATABASE_USER : artifactory
JF_SYSTEM_YAML : /opt/jfrog/artifactory/var/etc/system.yaml
JF_ARTIFACTORY_PID : /opt/jfrog/artifactory/app/run/artifactory.pid
JF_SHARED_DATABASE_TYPE : postgresql
JF_SHARED_DATABASE_PASSWORD : ******
JF_PRODUCT_DATA_INTERNAL : /var/opt/jfrog/artifactory
JF_PRODUCT_HOME : /opt/jfrog/artifactory
JF_ROUTER_TOPOLOGY_LOCAL_REQUIREDSERVICETYPES : jfrt,jfac,jfmd,jffe,jfevt
JF_SHARED_DATABASE_HOST : postgres
JF_SHARED_DATABASE_URL : jdbc:postgresql://postgres:5432/artifactory
JF_SHARED_DATABASE_DRIVER : org.postgresql.Driver
JF_SHARED_NODE_IP : 172.19.0.3
JF_SHARED_NODE_ID : da6d3e81a7c5
JF_ARTIFACTORY_USER : artifactory
不知道该在其他地方使用。感谢您的帮助!
答案 0 :(得分:1)
你快到了,
您有错字,应该是
JF_SHARED_DATABASE_USERNAME
不是
JF_SHARED_DATABASE_USER