我(仍在)尝试通过docker和docker-mysql文件设置汇合
当我将confluence作为服务运行时,可以很好地连接到数据库。
当我尝试通过docker-compose对docker-container进行相同操作时,我得到:
SQLState - 08S01
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
这是我的码头工人组成:
version: '2'
services:
confluence:
image: eugenmayer/confluence:7.4.0
build:
context: ./
args:
CONFLUENCE_VERSION: 7.4.0
container_name: confluence
volumes:
- confluencedata:/var/atlassian/confluence
ports:
- '80:8090'
- '8091:8091'
environment:
- CONFLUENCE_DB_HOST=db
- CONFLUENCE_DB_PORT=3306
- CATALINA_OPTS=-Xms256m -Xmx1g
- CONFLUENCE_PROXY_NAME=
- CONFLUENCE_PROXY_PORT=
- CONFLUENCE_PROXY_SCHEME=
- CONFLUENCE_DELAYED_START=
# those are preconfigurations so that we do not need to set our DB creds when installing - you can also
# no use that and do it manually during the interactive installation
# TODO: even though it lands in the configuration it seems to not really picked up by confluence during the installation
- CONFLUENCE_CONFIG_PROPERTY1=hibernate.connection.driver_class
- CONFLUENCE_CONFIG_VALUE1=org.mysql.Driver
- CONFLUENCE_CONFIG_PROPERTY2=hibernate.connection.password
- CONFLUENCE_CONFIG_VALUE2=jellyfish
- CONFLUENCE_CONFIG_PROPERTY3=hibernate.connection.url
- CONFLUENCE_CONFIG_VALUE3=mysql://confluencedb@db/confluencedb?sessionVariables=tx_isolation='READ-COMMITTED'
- CONFLUENCE_CONFIG_PROPERTY4=hibernate.connection.username
- CONFLUENCE_CONFIG_VALUE4=confluencedb
#- CONFLUENCE_CONFIG_PROPERTY1=confluence.setup.server.id
#- CONFLUENCE_CONFIG_VALUE1=BDYQ-V8CF-XUYW-DIWK
volumes:
confluencedata:
external: false
postgresqldata:
external: false
我是docker的新手,我也不知道为什么要这么做。至少我要说的也是最后一招,将融合作为服务运行并不是最佳选择
这是数据库的docker组合:
version: '3.3'
services:
db:
image: mysql:5.7
command: --character-set-server=utf8 --collation-server=utf8_general_ci
restart: always
environment:
MYSQL_DATABASE: bachelorarbeit_database
# So you don't have to use root, but you can if you like
MYSQL_USER: horizon
# You can use whatever password you like
MYSQL_PASSWORD: 1P@ssw0rt123
# Password for root access
MYSQL_ROOT_PASSWORD: P@ssw0rt
MYSQL_ROOT_USER: root
ports:
# <Port exposed> : < MySQL Port running inside container>
- '3310:3306'
答案 0 :(得分:0)
为什么要使用3310连接mysql? 3306是它的标准端口。
答案 1 :(得分:0)
在MySQL映像的定义中,公开了3310作为DB端口。但是,合流定义中提到了3306,而JDBC字符串忽略了该端口,因此使用该端口。
此外,上面关于docker网络的评论会使它变得复杂。
答案 2 :(得分:0)
答案 3 :(得分:0)
如果您不坚持使用MySQL DB,则可以使用Postgres。如果您可以更改数据库,我可以为您提供一个有效的docker-compose
version: '3.8'
volumes:
pgdata:
services:
confluence:
depends_on:
- postgres
image: atlassian/confluence-server:${CONFLUENCE_VERSION:?err}
volumes:
- ./data/confluence:/var/atlassian/application-data/confluence:rw,cached
ports:
- "127.0.0.1:8090:8090"
- "127.0.0.1:8091:8091"
environment:
- JVM_MINIMUM_MEMORY=1024m
- JVM_MAXIMUM_MEMORY=1024m
- JVM_SUPPORT_RECOMMENDED_ARGS=${DEBUG} ${MINIFICATION} ${PLUGIN_TIMEOUT} ${MAIL}
- ATL_DB_DRIVER=org.postgresql.Driver
- ATL_DB_TYPE=postgresql
- ATL_JDBC_URL=jdbc:postgresql://postgres:5432/${DB:?err}
- ATL_JDBC_USER=${DB_USER:?err}
- ATL_JDBC_PASSWORD=${DB_PASSWORD:?err}
postgres:
image: postgres:${POSTGRES_VERSION:?err}
volumes:
- pgdata:/var/lib/postgresql/data:cached
ports:
- "127.0.0.1:6543:5432"
environment:
- POSTGRES_DB=${DB:?err}
- POSTGRES_USER=${DB_USER:?err}
- POSTGRES_PASSWORD=${DB_PASSWORD:?err}
使用的变量存储在docker-compose文件旁边的.env文件中
CONFLUENCE_VERSION=7.7.2
POSTGRES_VERSION=9.6
PLUGIN_TIMEOUT=-Datlassian.plugins.enable.wait=120
#MAIL=-Datlassian.mail.senddisabled=true -Datlassian.mail.fetchdisabled=true -Datlassian.mail.popdisabled=true
DB=confluence772
DB_USER=confdbuser
DB_PASSWORD=passw0rd
postgres和confluence的版本在.env文件中设置。
使用
docker-compose up -d
并停止它
docker-compose stop
您可以使用docker-compose exec --user root confluence /bin/bash
在合流内部执行root shell
或带有docker-compose exec --user confluence confluence /bin/bash