Docker Compose: Memory and Memory Swap Limits
If you search "docker compose memory swap limit" on google, it will return incorrect information. To define memory swap in Docker Compose, place memswap_limit directly under the services definition, alongside other service-level configurations.