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!

2 Answers

If you look into the 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.

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"]
  ...
4

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Sarah Jenkins

Sarah Jenkins

Senior Technology Editor & AI Specialist

Sarah Jenkins is a veteran tech journalist with over 12 years of experience covering artificial intelligence, mobile innovations, and digital ethics. Her insights have appeared in leading technology publications worldwide.

Share this article
Twitter Facebook Pinterest