Compose: docker-compose deploy not working

Created on 27 Feb 2019  路  6Comments  路  Source: docker/compose

docker-compose version 1.22.0, build f46880fe
Docker Engine 18.09.2

docker-compose.yml

version: '3.4' services: hello: image: nginx deploy: replicas: 2 update_config: parallelism: 1 delay: 1s restart_policy: condition: on-failure

WARNING: Some services (hello) use the 'deploy' key, which will be ignored. Compose does not support 'deploy' configuration - use docker stack deploy to deploy to a swarm.

deploy not work

stale

Most helpful comment

when use docker-compose add a parameter --compatibility,like docker-compose --compatibility up -d maybe help you!

All 6 comments

@arrow2012 Thank you for your report.

It seems that use are using docker-compose to run the hello service. However the deploy keyword in a compose file is reserved for the deployment of stacks in a swarm cluster (https://docs.docker.com/compose/compose-file/#deploy) and this section of the compose file is ignored when deployed with docker-compose.
Did you encounter any other error message?

Yes. yml version 3.7. docker-compose version 1.24.1, build 4667896b.
"WARNING: Some services (service_name) use the 'deploy' key, which will be ignored. Compose does not support 'deploy' configuration - use docker stack deploy to deploy to a swarm."


deploy:
resources:
limits:
cpus: '2'
memory: 4096M
reservations:
cpus: '0.25'
memory: 512M

That is just a warning telling that docker-compose does not provide any functionality we are expecting under the deploy

Means, if you want use the deploy option you cannot just use docker-compose up -d you need to initiate the docker swarm docker init swarm and then do docker stack deploy --compose-file="docker-compose.yml" stack to start containers under docker swarm.

when use docker-compose add a parameter --compatibility,like docker-compose --compatibility up -d maybe help you!

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

This issue has been automatically closed because it had not recent activity during the stale period.

Was this page helpful?
0 / 5 - 0 ratings