创建服务失败,并显示"No command specified"



我在容器领域很陌生。我正在尝试在docker_composer的帮助下启动并运行ora2pg,但是收到以下错误消息:

postgres_db是最新的

正在创建ora2pg_client...错误

错误:对于ora2pg_client无法为服务 ora2pg 创建容器:未指定命令

错误:对于 ora2pg 无法为服务 ora2pg 创建容器:未指定命令

错误

:启动项目时遇到错误。

我的docker-composer.yml如下:

version: "3.7"
services:
 postgresql:
  restart: always
  image: postgres
  container_name: "postgres_db"
  ports:
  - "5432:5432"
  environment:
  - DEBUG=false
  - DB_USER=
  - DB_PASS=
  - DB_NAME=
  - DB_TEMPLATE=
  - DB_EXTENSION=
  - REPLICATION_MODE=
  - REPLICATION_USER=
  - REPLICATION_PASS=
  - REPLICATION_SSLMODE=
  volumes:
  - ./postgres/data:/var/lib/postgresql/data
  - ./postgres/initdb:/docker-entrypoint-initdb.d
 ora2pg:
  image: flockers/ora2pg
  container_name: "ora2pg_client"
  environment:
  - DB_HOST=127.0.0.1
  - DB_SID=xe
  - ORA2PG_USER=MAX
  - DB_PASS=MAX
  volumes:
  - ./ora2pg/export:/export

注意:我在同一台计算机上已经有一个 Oracle 数据库。

谢谢!

如果您查看 Dockerfile,https://hub.docker.com/r/flockers/ora2pg/dockerfile flockers/ora2pg缺少CMDentrypoint

 ora2pg:
  image: flockers/ora2pg
  container_name: "ora2pg_client"
  environment:
  - DB_HOST=127.0.0.1
  - DB_SID=xe
  - ORA2PG_USER=MAX
  - DB_PASS=MAX
  volumes:
  - ./ora2pg/export:/export
  command: tail -f /dev/null

所以在这里command: tail -f /dev/null它只会保持你的容器运行,不会做任何事情,用你的命令代替。

flockers/ora2pg没有

指定任何CMD,您可以通过运行以下命令来证明这一点:

docker pull flockers/ora2pg
docker image inspect flockers/ora2pg
[ 
...
 "Cmd": null
...
]

Docker 映像中的CMDENTRYPOINT将定义它们的运行方式,有关详细信息,请参阅 Dockerfile 参考。两者都未在正在运行的映像中定义。

您可以使用以下命令在docker-compose文件中定义command

ora2pg:
  image: flockers/ora2pg
  container_name: "ora2pg_client"
  command: ["some", "command", "running", "your", "database"]
  ...

最新更新