【发布时间】:2017-09-07 14:35:36
【问题描述】:
以下代码在 docker-compose 中使用:
integration_test:
image: service:1.0.0
volumes:
- .:/service
links:
- oracle_container
# used volumes_from as workaround to wait until the following containers to start
volumes_from:
- oracle_container
container_name: integration_test
tty: true
environment:
USER: go
command: ["mvn clean install -DskipTests"]
oracle_container:
image: inmage_name:1.0.0
container_name: oracle_container
ports:
- "49161:1521"
我想让这两个容器都说应用程序-->oracle
两个容器都在同一台机器上运行,我使用下面的 jdbc 字符串通过应用程序连接 oracle,
jdbc:oracle:thin:@localhost:49161/xe
但我无法连接 oracle 及其引发的 SQLRecoverable Exception。
据我了解,这属于 Docker 网络,我使用链接来连接两个容器。但这个问题与连接字符串有关,更具体地说是 oracle 容器的 ip。
有人可以帮忙解决这个问题吗?
【问题讨论】:
标签: docker docker-compose