In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces "how to solve the problem of Windows Service 2019 using Docker". In daily operation, I believe many people have doubts about how to solve the problem of using Docker in Windows Service 2019. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the problem of "how to solve the problem of Windows Service 2019 using Docker". Next, please follow the editor to study!
Preparatory work
Operating system: Windows Service 2019
Start the installation of Hyper-V
Install through Server Manager-> add roles and features.
Select Hyper-V in the server role selection interface, and then continue to the next step.
Install Container Install-WindowsFeature-Name containers install Docker
Open an elevated PowerShell session and install the Docker-Microsoft PackageManagement provider from the PowerShell library.
Install-Module-Name DockerMsftProvider-Repository PSGallery-Force
If prompted to install the NuGet provider, also type Y to install it.
If you encounter an error when opening the PowerShell library, you may need to set the version of TLS used by the PowerShell client to TLS 1.2. To do this, run the following command:
# Set the TLS version used by the PowerShell client to TLS 1.2. [System.Net.ServicePointManager]:: SecurityProtocol = [System.Net.SecurityProtocolType]:: Tls12
two。 Use the PackageManagement PowerShell module to install the latest version of Docker.
Install-Package-Name docker-ProviderName DockerMsftProvider
When PowerShell asks if you trust the package source "DockerDefault", type A to continue with the installation.
3. After the installation is complete, restart your computer.
Restart-Computer-Force install docker-compose
You can use the link to query the latest docker-compose and then use Powershell to execute the following command to install.
Invoke-WebRequest https://github.com/docker/compose/releases/download/v2.5.1/docker-compose-windows-x86_64.exe-UseBasicParsing-OutFile $env:ProgramFiles\ docker\ docker-compose.exe switch kernel (there is a problem with this method)
After installation, it defaults to the Windows kernel container, which can be manually switched to the Linux kernel container, but I don't think it makes much sense. You can install a Linux virtual machine on the server through the Hyper-V manager, run the Docker under Linux in the virtual machine, realize the Docker service with both kernels, and then manage it uniformly through the Swarm that comes with Docker. Swarm will be automatically published to the Docker of the corresponding kernel according to the type of image.
Switch to the Linux kernel container
[Environment]:: SetEnvironmentVariable ("LCOW_SUPPORTED", "1", "Machine") Restart-Service Docker
Switch to the Windows kernel container
[Environment]:: SetEnvironmentVariable ("LCOW_SUPPORTED", $null, "Machine") Restart-Service Docker updates Docker
1. Check the installed version using the following command:
Get-Package-Name Docker-ProviderName DockerMsftProvider
two。 Use the following command to find the current version:
Find-Package-Name Docker-ProviderName DockerMsftProvider
3. When you are ready to upgrade, run the following command:
Install-Package-Name Docker-ProviderName DockerMsftProvider-Update-Force
Finally, run the following command to start Docker:
Start-Service Docker Uninstall Docker prepare your system to remove Docker
Before uninstalling Docker, make sure that no containers are running on the system.
Run the following cmdlet to check for running containers:
# Leave swarm mode (this will automatically stop and remove services and overlay networks) docker swarm leave-- force# Stop all running containersdocker ps-- quiet | ForEach-Object {docker stop $_}
It is best to remove all containers, container images, networks, and volumes from the system before removing Docker. To do this, you can run the following cmdlet:
Docker system prune-- volumes-- all is officially uninstalled
Use Uninstall-Package and Uninstall-Module cmdlet to remove the Docker module and its corresponding package management provider from the system, as shown in the following example:
Uninstall-Package-Name docker-ProviderName DockerMsftProviderUninstall-Module-Name DockerMsftProvider cleans up Docker data and system components
After uninstalling Docker, you need to delete the default network for Docker. In this way, after you uninstall Docker, the configuration of these networks will not remain on the system. To do this, you can run the following cmdlet:
Get-HNSNetwork | Remove- HNSNetwork``PowerShell removes the default network for Docker on Windows Server 2016.
Get-ContainerNetwork | Remove-ContainerNetwork
Delete the program data of Docker from the system by running the following cmdlet: ```PowerShellRemove-Item "C:\ ProgramData\ Docker"-Recurse
Restart the system:
Known problems with Restart-Computer-Force
If you prompt the npipe connection to fail when executing the command.
Error during connect: This error may indicate that the docker daemon is not running.: Get "http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/images/json": open / /. / pipe/docker_engine: The system cannot find the file specified.
# you can consider how to handle it: add "npipe://" to the C:\ ProgramData\ Docker\ config\ daemon.json file. # similar to the configuration {"hosts": ["tcp://0.0.0.0:2375", "npipe://"]}, the study on "how to solve the problem of Windows Service 2019 using Docker" is over. I hope to be able to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.