Given the following (simplified for the sake of argument) docker-compose.yml
file:
version: '3'
services:
postgres:
image: fleetit-postgres
deploy:
restart-policy:
condition: on-failure
ports:
- "5432:5432"
environment:
POSTGRES_USER: "root"
POSTGRES_PASSWORD: "demo1234"
POSTGRES_DB: "fleetit"
I was trying to deploy a stack with the command
docker stack deploy -c docker-compose.yml stackdemo
But it just throws me the error
restart-policy Additional property restart-policy is not allowed
What am I doing wrong?
This is the version of Docker I am running:
$ docker version
Client:
Version: 18.04.0-ce
API version: 1.37
Go version: go1.10.1
Git commit: 3d479c0af6
Built: Tue Apr 17 22:46:17 2018
OS/Arch: linux/amd64
Experimental: false
Orchestrator: swarm
Server:
Engine:
Version: 18.04.0-ce
API version: 1.37 (minimum version 1.12)
Go version: go1.10.1
Git commit: 3d479c0af6
Built: Tue Apr 17 22:46:48 2018
OS/Arch: linux/amd64
Experimental: false
Restart Policy in Docker Compose Like the restart Docker command, Docker Compose includes the restart property to restart containers automatically. Besides, we can define restart policies in Docker Compose by providing the restart property to the service in the docker-compose. yml file.
Use the --publish-add or --publish-rm flags to add or remove a published port for a service.
By default, when an update to an individual task returns a state of RUNNING , the scheduler schedules another task to update until all tasks are updated. If, at any time during an update a task returns FAILED , the scheduler pauses the update.
You have a typo. Its should be restart_policy
with an underscore instead of restart-policy
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With