bitroid
(Bitroid)
1
Hello team,
When i execute below stack yaml file.
version: "3.7"
services:
app:
image: sath89/oracle-12c:latest
ports:
- "8080:8080"
- "1521:1521"
stop_grace_period: 1m0s
deploy:
replicas: 2
update_config:
parallelism: 1
delay: 40s
restart_policy:
condition: on-failure
max_attempts: 3
placement:
constraints: [node.role == worker]
networks:
- fronter
command: ./builderdesktop.sh
networks:
fronter:
It is throwing error as “command Additional property command is not allowed.”
Can you please check and advise.
Thanks,
Hemanth.
terpz
(Martin Terp)
2
Hi 
Its because you have “command:” under deploy, the same goes for “networks:”, these are not valid arguments for “deploy”
Try this
bitroid
(Bitroid)
3
Thanks terpz,
But this time i am getting new error.
\_ replicaoracle_app.1 sath89/oracle-12c:latest localhost.localdomain Shutdown Failed 2 seconds ago "task: non-zero exit (1)"
My requirement of adding command function in yaml file.
First containers should be up and running in detached mode after creating services.
Second when services status are running state, from command function it should execute below script mentioned in filename : ./builderdesktop.sh
#!/bin/bash
docker logs --timestamps $(docker ps -aq)
sleep 500
docker logs --timestamps $(docker ps -aq)
docker stack ls
docker exec -it --user root $(docker ps -aq) /bin/bash -c "apt-get update;apt-get -y install git"
docker exec -it --user root $(docker ps -aq) /bin/bash -c "git clone https://github.com/hemanth22/Oracle_database.git"
docker exec -it --user root $(docker ps -aq) /bin/bash -c "chmod -R 777 /Oracle_database;cd /Oracle_database;ls -la"
docker exec -it --user oracle $(docker ps -aq) /bin/bash -c "netstat -nlpt"
docker exec -it --user oracle $(docker ps -aq) /bin/bash -c "ls && cd /Oracle_database && ls && bash login.sh"
docker stop $(docker ps -aq)
docker rm $(docker ps -aq)
docker rmi $(docker images -aq)
Can you please advice whether yaml written by me is wrong or correct to execute according to my requirement.
Thanks,
Hemanth