Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The following deploy sub-keys are not supported in compatibility mode

I have to use a memory limit of 500MB and CPU set to 0.6 for a service and I also need to use version 3 in the docker-compose file.

I try: $ docker-compose docker_compose.yml --compatibility up

and I get:

WARNING: The following deploy sub-keys are not supported in compatibility mode and have been ignored: resources.reservations.cpus

version: '3.3'

services:
   web:
     image: myimage:1.2.3
     volumes:
       - 'delle:/home/rh'
     deploy:
      resources:
        limits:
          memory: 500M
        reservations:
          cpus: '0.6'
     networks:
       - mynetwork
       - internal

networks:
  mynetwork:
    external: true
  internal:
volumes:
    delle:

Can somebody help? Swarm only?

like image 870
caprio Avatar asked Nov 07 '22 13:11

caprio


1 Answers

Might as well use v2 for docker-compose file.

version: "2.4"

services:
   web:
     image: myimage:1.2.3
     volumes:
       - 'delle:/home/rh'
     cpu_count: 1
     cpus: 0.6
     cpu_percent: 30
     mem_limit: 500m
     networks:
       - mynetwork
       - internal

networks:
  mynetwork:
    external: true
  internal:
volumes:
    delle

For v3, this explains why it doesn't support resources.reservations.cpus and resources.limits.cpus as memory. See thread

Docker Compose doesn't work with swarm mode (it deploys local containers), so there's no orchestrator to take those limits into account

as @Kalpesh pointed out (below my comment), try removing resources, reservations cpus.

you could inspect it via:

# run compatibility
docker-compose --compatibility up -d

docker inspect --format '{{json .HostConfig.Memory}}' <CONTAINER_NAME> | numfmt --to=iec

docker inspect --format '{{json .HostConfig.NanoCpus}}' <CONTAINER_NAME> | numfmt --to=iec

like image 120
Jaeyson Anthony Y. Avatar answered Nov 15 '22 05:11

Jaeyson Anthony Y.