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