Docker 17.12.0-ce内存扩容咨询:Win10 Linux环境仅分配15MB
Hey there! Let's sort out that frustratingly small 15MB memory allocation for your Docker setup on Windows 10's Linux environment. Since you're running Docker 17.12.0-ce and the advanced settings menu doesn't show a 2GB option, here are some solid, no-reinstall ways to bump up the memory:
1. Adjust VirtualBox VM Settings (For Docker Toolbox)
If your Docker is running on a VirtualBox-backed VM (common with Docker Toolbox), this is the most straightforward fix:
- First, shut down all running containers and the Docker VM:
docker stop $(docker ps -aq) docker-machine stop default - Open VirtualBox, locate the
defaultVM (this is Docker's default virtual machine) - Right-click it, select Settings -> System -> Motherboard, then set Base Memory to 2048MB (2GB) or your desired amount
- Fire up the Docker VM again and apply the environment variables:
docker-machine start default eval $(docker-machine env default) - Verify the change worked by running:
docker run --rm busybox free -m
2. Edit the Docker Daemon Configuration File
If you're running Docker directly within a WSL environment or have access to the daemon config:
- Check if the daemon config file exists at
/etc/docker/daemon.json; if not, create it - Open the file with a text editor and add the memory allocation (set to 2GB here):
{ "resources": { "memory": "2048m" } } - Restart the Docker service to apply changes:
sudo systemctl restart docker - Confirm the new memory limit with:
docker info | grep Memory
3. Tweak WSL Memory Allocation (For WSL-Backed Docker)
If your Docker is using WSL 1 or WSL 2 as its backend:
- Shut down all WSL instances and Docker completely:
wsl --shutdown - On your Windows system, navigate to your user directory (e.g.,
C:\Users\YourUsername) and create/edit a file named.wslconfig - Add these lines to set the memory to 2GB (you can adjust the value as needed):
[wsl2] memory=2GB - Restart WSL and Docker, then check the memory with:
wsl free -m
内容的提问来源于stack exchange,提问作者Ovais Jaffery
相关产品推荐
相关产品推荐

