docker-archive / classicswarm

Swarm Classic: a container clustering system. Not to be confused with Docker Swarm which is at https://github.com/docker/swarmkit
Apache License 2.0
5.75k stars 1.08k forks source link

docker: Error response from daemon: no resources available to schedule container. #2856

Closed henryliuom closed 6 years ago

henryliuom commented 6 years ago

when we ran command docker -H 10.163.236.268:2234 run --name=xxx-xxx-backend-test -d --cpu-period=90000 --cpu-quota=85000 -m 800m --oom-kill-disable=false -p 0.0.0.0::7080 -p 0.0.0.0:: 4200 -p 0.0.0.0::8000 -e TZ=Asia/Shanghai -e project_name=xxx-xxx-backend -e environment=test docker-registry.uworks.cc:1024/java-jdk1.8-springboot, we got the error: docker: Error response from daemon: no resources available to schedule container. See 'docker run --help'.

then i execute command docker -H 10.163.236.268:2234 info, and print information like this: Containers: 177 Running: 170 Paused: 0 Stopped: 7 Images: 55 Server Version: swarm/1.2.8 Role: primary Strategy: binpack Filters: health, port, containerslots, dependency, affinity, constraint, whitelist Nodes: 5 incubatC: 10.29.241.205:2375 └ ID: 65RH:IC77:YWKB:2YQX:UG26:GGCX:KDQA:J7X6:MEEM:YDEB:UCQL:ZCOQ|10.29.241.205:2375 └ Status: Healthy └ Containers: 31 (31 Running, 0 Paused, 0 Stopped) └ Reserved CPUs: 0 / 2 └ Reserved Memory: 16.57 GiB / 16.46 GiB └ Labels: kernelversion=3.8.0-44-generic, operatingsystem=Ubuntu precise (12.04.5 LTS), ostype=linux, storagedriver=aufs └ UpdatedAt: 2018-04-19T06:54:59Z └ ServerVersion: 1.10.3 ……………………………… Plugins: Volume: Network: Kernel Version: 3.8.0-44-generic Operating System: linux Architecture: amd64 CPUs: 10 Total Memory: 82.28 GiB Name: 3226b2909fa9

how can i fix it?thanks

henryliuom commented 6 years ago

the system memory still have enough space: root@incubatC:~# free -m total used free shared buffers cached Mem: 16050 9991 6058 0 506 1109 -/+ buffers/cache: 8375 7674 Swap: 0 0 0

ccl0326 commented 6 years ago

the memory of container used are reserved, so if run a container with 1G memory, docker or swarm will hold 1G memory for this container always, although the container only used a little memory right now.

thaJeztah commented 6 years ago

Yes, this looks the expected behavior;

Reserved Memory: 16.57 GiB / 16.46 GiB

the scheduler has memory reserved for services/containers you deployed; reserved doesn't mean "used", but only that you asked the scheduler to not deploy more containers if no memory can be reserved to deploy more.

I'm closing this issue because this doesn't look like a bug, but feel free to continue the conversation