I'm trying to set up two docker containers, one is for the actual service that takes POST, PUT, DELETE, GET requests, and the second one is for an internal scheduler that will submit a POST request to the service every day.
This is my docker-compose.yml:
version: "3"
services:
holidayservice:
image: holiday-service:1.0
build: .
command: uvicorn app:app --reload --host 0.0.0.0 --port 8000
volumes:
- db-data:/code
ports:
- "8001:8000"
scheduler:
image: ghcr.io/umputun/cronn
command: /srv/cronn -c "0 0 * * * /usr/bin/curl -X POST http://holidayservice:8000/holidays/ -u user:password"
ports:
- "27017:27017"
volumes:
db-data:
And I have an issue with this scheduling command:
/srv/cronn -c "0 0 * * * /usr/bin/curl -X POST http://holidayservice:8000/holidays/ -u user:password"
If I connect to the terminal of the second container by running this:
docker exec -it containerID /bin/sh
and then run the scheduling command, everything works and I get no errors, I tried to change my scheduling command by putting single quotes around double quotes, etc., but either way I get an error unknown flag 'X'
or invalid argument for flag -c, --command' (expected string): invalid syntax
I ran out of ideas of what else to try, please help, thank you.