【问题标题】:Issue with docker compose db2-express cdocker compose db2-express c 的问题
【发布时间】:2016-08-01 13:00:06
【问题描述】:

我正在尝试建立一个用于开发我的项目的环境。我需要一个 websphere 容器和一个 db2 容器。 我在我的仓库中提交了我自己的容器版本,现在使用一个命令 docker-compose up 我想启动整个环境。 我的 docker-compose.yml 是

version: '2'
services:
 web:
  image: <my_user>/websphere-liberty-of-mine
  ports:
  - "80:9080"
  - "443:9443"
 db:
  image: <my_user>/db2-of-mine
  ports:
  - "50000:50000"
 environment:
 - DB2INST1_PASSWORD=***
 - LICENSE=accept

web 容器启动并保持正确运行,而不是 db DB2 容器启动并立即停止,消息是:

Changing password for user db2inst1.
passwd: all authentication tokens updated successfully.
New password: Retype new password:

如何正常启动db DB2容器?
此外,如果我的 docker-compose 版本是

,我如何才能明确地为两个容器设置网络和 IP 地址
$ docker-compose version
docker-compose version 1.7.1, build 0a9ab35
docker-py version: 1.8.1
CPython version: 2.7.11
OpenSSL version: OpenSSL 1.0.2d 9 Jul 2015

【问题讨论】:

  • 您使用的是哪个 DB2 容器?
  • 我从 ibmcom/db2express-c:latest 开始,在那里我创建了我的数据库和我的数据。然后我提交并推送了这个容器的图像。
  • 我个人推荐使用我自己的Docker镜像hub.docker.com/u/angoca,它基于不同镜像的最佳实践,它是开源的。不像 IBM 的形象,它是封闭源代码,不再维护。
  • @AngocA 我使用你的 andoga/bd2-instance 图像,只有我创建我的数据库并加载我的数据。然后我将它作为一个新图像推送到我的 repo 中,并尝试在 docker-compose.yml 中使用这个新图像,还添加了 privileged: true 但也以这种方式添加了 db容器立即启动和停止
  • 我知道在 Docker 中以特权模式执行命令存在一些问题。因此,无法激活实例,因此容器停止。

标签: networking docker db2 docker-compose db2-express-c


【解决方案1】:

试试这个:

version: '2'
services:
 web:
  image: <my_user>/websphere-liberty-of-mine
  ports:
  - "80:9080"
  - "443:9443"
 db:
  image: <my_user>/db2-of-mine
  ports:
  - "50000:50000"
  command: su - db2inst1 -c "db2start" # Add this line and it should work
 environment:
 - DB2INST1_PASSWORD=***
 - LICENSE=accept

我之前遇到过同样的问题,发现 ibmcom/db2express-c 没有自动启动。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-07-11
    • 2023-03-17
    • 2021-10-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-13
    相关资源
    最近更新 更多