Dax
Dax

Reputation: 470

Creating a service failed with "No command specified"

I am very new in the container world. I am trying to get the ora2pg to up and running with the help of docker_composer, but I get the following error message:

postgres_db is up-to-date

Creating ora2pg_client ... error

ERROR: for ora2pg_client Cannot create container for service ora2pg: No command specified

ERROR: for ora2pg Cannot create container for service ora2pg: No command specified

ERROR: Encountered errors while bringing up the project.

My docker-composer.yml is as below:

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

Note: I already have an Oracle database on the same machine.

Thank you!

Upvotes: 2

Views: 20456

Answers (2)

Adiii
Adiii

Reputation: 60134

If you look into the Dockerfile https://hub.docker.com/r/flockers/ora2pg/dockerfile flockers/ora2pg the CMD or entrypoint is missing.

 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

So here command: tail -f /dev/null it will just keep your container running and will not do anything, replace with your command.

Upvotes: 7

Pierre B.
Pierre B.

Reputation: 12953

flockers/ora2pg do not have any CMD specified, you can show that by running:

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

CMD and ENTRYPOINT in Docker images will define how they are run, see Dockerfile reference for details. Neither is defined in the image you are running.

You can define a command with in your docker-compose file with:

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

Upvotes: 3

Related Questions