Limit resources in docker-compose v3
I was wondering the same thing and found this:
https://github.com/docker/compose/issues/4513
So in short it's just not possible to do that, you have to use the version 2.1 of the docker-compose format to be able to specify limits that are not ignored by docker-compose up
Limit container resources on Ubuntu
Compose file version 2 supports these in the per-service specification.
version: '2.4'
services:
queue:
cpu_count: 2
mem_limit: 4g
memswap_limit: 4g # -1 doesn't seem to be valid
In general version 2 has more of the docker run
options, and version 3 is geared more towards Swarm-specific options. The version 3 equivalent would be the deploy:
resources:
section, but everything under deploy:
is ignored by docker-compose up
. Both versions are supported and it's fine to use version 2 Compose files if you need it.
Related Topics
What Length Can a Network Interface Name Have
How to Find List of Odbc Drivers Installed on Linux
Pkill Returns 255 in Combination with Another Command via Remote Ssh
Docker Oci Runtime Create Failed: Container_Linux.Go:349: Starting Container Process Caused
How to Get Only Filenames Without Path by Using Grep
Font Are Not Displayed in Idea
How to Use Find -Exec in Cmake Execute_Process
How to Append to an Indirect Parameter Expansion of an Array in Bash
Synchronizing Four Shell Scripts to Run One After Another in Unix
Linux How to Add a File to a Specific Folder Within a Zip File
Anaconda Libstdc++.So.6: Version 'Glibcxx_3.4.20' Not Found
How to Manage Log Verbosity Inside a Shell Script
How to Use a Seq_File in Linux Kernel Modules
What's the Purpose of the Ud2 Opcode in the Linux Kernel
Does the Linux Scheduler Prefer to Run Child Process After Fork()
Case in Bash: "Line 4: Syntax Error Near Unexpected Token ')'"