Skip to content

How can I implement dynamic memory allocation #1615

@Nikdcs

Description

@Nikdcs

Operating system

Ubuntu 24.04

Description

My docker-compose.yaml is as follows.
In the .yaml file, I found that the Windows system inside the container only uses a little over 2GB of memory, but the container actually occupies a fixed 8GB of memory on the host machine.
How can I implement dynamic memory allocation—i.e., the container occupies memory on the host machine only as much as the Windows system inside it uses, instead of a fixed 8GB allocation?-

Docker compose

services:
  windows:
    image: dockurr/windows:5.12
    container_name: win10l
    devices:
      - /dev/kvm     
      - /dev/net/tun  
    cap_add:
      - NET_ADMIN
    ports:
      - 60511:8006     
      - 60512:3389/tcp
      - 60512:3389/udp
    volumes:
      - /storage/docker/qume/data/windows/mirror/win10lx64_zh.iso:/boot.iso
      - /storage/docker/qume/win10l:/storage 
    environment:
      VERSION: "10l"    
      CPU_CORES: "4"   
      RAM_SIZE: "8G"   
      LANGUAGE: "Chinese" 
      USERNAME: "trong" 
      PASSWORD: "123123"
      DISK_SIZE: "100G"  
    stop_grace_period: 2m 
    restart: always
    networks:  
      1panel-network:
        ipv4_address: 172.18.1.52  

networks:
  1panel-network:
    external: true

Docker log

None

Screenshots (optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions