How to assign more memory to docker container

后端 未结 3 699
不知归路
不知归路 2020-11-27 12:48

As the title reads, I\'m trying to assign more memory to my container. I\'m using an image from docker hub called \"aallam/tomcat-mysql\" in case that\'s relevant.

W

相关标签:
3条回答
  • 2020-11-27 12:54

    That 2GB limit you see is the total memory of the VM in which docker runs.

    If you are using docker-for-windows or docker-for-mac you can easily increase it from the Whale

    0 讨论(0)
  • 2020-11-27 13:09

    Allocate maximum memory to your docker machine from (docker preference -> advance )

    Screenshot of advance settings: Screenshot of advance settings.

    This will set the maximum limit docker consume while running containers. Now run your image in new container with -m=4g flag for 4 gigs ram or more. e.g.

    docker run -m=4g {imageID}
    

    Remember to apply the ram limit increase changes. Restart the docker and double check that ram limit did increased. This can be one of the factor you not see the ram limit increase in docker containers.

    0 讨论(0)
  • 2020-11-27 13:09

    If you want to change the default container and you are using Virtualbox, you can do it via the commandline / CLI:

    docker-machine stop
    VBoxManage modifyvm default --cpus 2
    VBoxManage modifyvm default --memory 4096
    docker-machine start
    
    0 讨论(0)
提交回复
热议问题