In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article shows you how to analyze the configuration and modification of WSL in docker. The content is concise and easy to understand, which will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
Stored in the% UserProfile% directory.
Used to globally configure settings in all installed Linux distributions that run as a WSL2 version. Available for distributions that WSL2 runs.
Distributions running as WSL 1 are not affected by this configuration because they do not run as virtual machines.
To access your% UserProfile% directory, use CD~ in PowerShell to access your home directory (usually your user profile, C:\ Users\), or you can open Windows File Explorer and enter% UserProfile% in the address bar. The directory path should look like: C:\ Users\\. Wslconfig . WSL detects the existence of these files, reads the contents, and automatically applies configuration settings each time WSL is started. If the file is missing or incorrectly formatted (incorrect markup format), WSL will continue to start normally without applying configuration settings.
Check the version of WSL you are running.
Use wsl to adjust each distribution setting. Conf files are only available in Windows Build 17093 and later.
Configuration settings for wslconfig
This wslconfig file globally configures the settings for all Linux distributions running WSL2. For each distribution configuration, see wsl.conf.
See the WSLConfigf for information about the storage location. Wslconfig file.
Notes
Global configuration options that you have. Wslconfigis is only available for distributions running as WSL 2 in Windows Build 19041 and later. Keep in mind that you may need to run WSL--shutdown to shut down WSL2VM, and then restart the WSL instance for these changes to take effect.
This file can contain the following options that affect the VM that powers any WSL 2 distribution:
Section label: [wsl2]
KeyvaluedefaultnoteskernelstringThe Microsoft built kernel provided inboxAn absolute Windows path to a custom Linux kernel.memorysize50% of total memory on Windows or 8GB, whichever is less; on builds before 20175: 80 of your total memory on WindowsHow much memory to assign to the WSL 2 VM.processorsnumberThe same number of processors on WindowsHow many processors to assign to the WSL 2 VM.localhostForwardingbooleantrueBoolean specifying if ports bound to wildcard or localhost in the WSL 2 VM should be connectable from the host via localhost:port.kernelCommandLinestringBlankAdditional kernel command line arguments.swapsize25% of memorysize on Windows rounded up to the nearest GBHow much swap space to add to the WSL 2 VM, 0 for no swap file. Swap storage is disk-based RAM used when memory demand exceeds limit on hardware device.swapFilestring%USERPROFILE%\ AppData\ Local\ Temp\ swap.vhdxAn absolute Windows path to the swap virtual hard disk.pageReportingbooleantrueDefault true setting enables Windows to reclaim unused memory allocated to WSL 2 virtual machine.guiApplicationsboolean*trueBoolean to turn on or off support for GUI applications (WSLg) in WSL. Only available for Windows 11.debugConsoleboolean*falseBoolean to turn on an output console Window that shows the contents of dmesg upon start of a WSL 2 distro instance. Only available for Windows 11.nestedVirtualizationboolean*trueBoolean to turn on or off nested virtualization, enabling other nested VMs to run inside WSL 2. Only available for Windows 11.vmIdleTimeoutnumber*60000The number of milliseconds that a VM is idle, before it is shut down. Only available for Windows 11.
Entries with pathValue must be Windows paths with escaped backslashes, for example: C:\\ Temp\\ myCustomKernel
Entries with SizeValue must be the size of the following unit, such as 8GB or 512MB.
Entries with a * after the value type are only available on Windows 11.
Instance wslconfig file
The following wslconfigsample file demonstrates some of the configuration options available. In this case, the file path is isC:\ Users\\. Wslconfig .
# Settings apply across all Linux distros running on WSL 2 [wsl2] # Limits VM memory to use no more than 4GB, this can be set as whole numbers using GB or MBmemory=4GB # Sets the VM to use two virtual processorsprocessors=2 # Specify a custom Linux kernel to use with your installed distros. The default kernel used can be found at https://github.com/microsoft/WSL2-Linux-Kernelkernel=C:\\temp\\myCustomKernel # Sets additional kernel parameters, in this case enabling older Linux base images such as Centos 6kernelCommandLine = vsyscall=emulate # Sets amount of swap storage space to 8GB, default is 25% of available RAMswap=8GB # Sets swapfile path location Default is% USERPROFILE%\ AppData\ Local\ Temp\ swap.vhdxswapfile=C:\\ temp\\ wsl-swap.vhdx # Disable page reporting so WSL retains all allocated memory claimed from Windows and releases none back when freepageReporting=false # Turn off default connection to bind WSL 2 localhost to Windows localhostlocalhostforwarding=true # Disables nested virtualizationnestedVirtualization=false # Turns on output console showing contents of dmesg when opening a WSL 2 distro for debuggingdebugConsole=true above is how to analyze WSL configuration and modification in docker Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.