Windows Server 2016 ile hayatımıza giren container özelliğinden sizlere biraz bahsetmek ve Windows Server 2019 üzerinde container teknolojisinin öncüsü olan docker kurulumunun nasıl yapacağınızı size anlatmak isterim. Sanallaştırma teknolojisinin ardından
gündemimize hızlı bir giriş yapan container mimarisi özelikle yazılımcıların çok kısa sürede vazgeçilmesi olmaya başlamıştır. Aynı işletim sistemi içerisinde aynı kaynakları kullanarak oluşturulan ve ihtiyaç durumunda kaynakların çok rahat azaltılarak yada
arttırılabilen bir alt yapıya sahip olan container teknolojisi kendi dosya sistemi, registry ve ağ adreslerine sahip olabildiği için diğer uygulamalardan da izole bir şekilde çalışma imkanı sunmaktadır. Esnek kullanım yapısı ile uygulama geliştiricilerin tercih
sebebi olmuştur. Peki bu container role kurulumu nasıl yapılır sunucuda nasıl aktif edilir birlikte bakalım. Container role kurulumunu docker ile eş zamanlı sizlere anlatmaya çalışacağım.
Docker EE Kurulumu
Modul kurulumu için "Install-Module" komutu ile kuruluma başlıyoruz.
Install-Module DockerMsftProvider -ForcePS C:\Users\Administrator> Install-Module DockerMsftProvider -ForceNuGet provider is required to continuePowerShellGet requires NuGet provider version '2.8.5.201' or newer to interact withNuGet-based repositories. The NuGet provider must be available in 'C:\ProgramFiles\PackageManagement\ProviderAssemblies' or'C:\Users\Administrator\AppData\Local\PackageManagement\ProviderAssemblies'. You canalso install the NuGet provider by running 'Install-PackageProvider -Name NuGet-MinimumVersion 2.8.5.201 -Force'. Do you want PowerShellGet to install and import theNuGet provider now?[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"):YDocker paketlerini yüklemek için "Install-Package" komutunu kullanıyoruz.
Install-Package Docker -ProviderName DockerMsftProvider -ForcePS C:\Users\Administrator> Install-Package Docker -ProviderName DockerMsftProvider -ForceWARNING: A restart is required to enable the containers feature. Please restart your machine.Name Version Source Summary---- ------- ------ -------Docker 18.09.4 DockerDefault Contains Docker EE ...PS C:\Users\Administrator> docker container run hello-world:nanoserverUnable to find image 'hello-world:nanoserver' locallynanoserver: Pulling from library/hello-world6a5e981230da: Pull completedc4b656f6979: Pull complete2848c5402b33: Pull complete9e0171b11ac8: Pull completeDigest: sha256:ea56d430e69850b80cd4969b2cbb891db83890c7bb79f29ae81f3d0b47a58dd9Status: Downloaded newer image for hello-world:nanoserverHello from Docker!This message shows that your installation appears to be working correctly.To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (windows-amd64, nanoserver-1809) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal.To try something more ambitious, you can run a Windows Server container with: PS C:\> docker run -it mcr.microsoft.com/windows/servercore powershellShare images, automate workflows, and more with a free Docker ID:For more examples and ideas, visit:Script kullanarak Docker EE Kurulumu
Docker kurulumunu Windows Core üzerinde yapacaksanız özelikle size çok faydalı olacak aşağıdaki komutları kullanabilirsiniz. Öncesinde Docker.com üzerinden ilgili paketlerimizi indiriyoruz.
PS C:\Users\Administrator> invoke-webrequest -UseBasicparsing -Outfile docker-17.06.2-ee-7.zip
https://download.docker.com/components/engine/windows-server/17.06/docker-17.06.2-ee-7.zipWindows PowerShellCopyright (C) Microsoft Corporation. All rights reserved. Writing web request Writing request stream... (Number of bytes written: 8431026)İndirdiğimiz zip dosyasını açarak iligli dizine kaydetmek için aşağıdaki komutumuzu kullanıyoruz.
PS C:\Users\Administrator> Expand-Archive docker-17.06.2-ee-7.zip -DestinationPath $Env: ProgramFilesİndirdiğimiz zip dosyasını silmek için
PS C:\Users\Administrator> Remove-Item -Force docker-17.06.2-ee-7.zipContainer role yüklemek için
PS C:\Users\Administrator> $null = Install-WindowsFeature containersYükleniyor...
Windows PowerShellCopyright (C) Microsoft Corporation. All rights reserved. Start Installation... 26% [ooooooooooooooooooo ]PS C:\Users\Administrator>
PS C:\Users\Administrator> $null = Install-WindowsFeature containersYükleme tamamlandı. Sistemi yeninden başlatmanız gerekiyor.
PS C:\Users\Administrator> $null = Install-WindowsFeature containersWARNING: You must restart this server to finish the installation process.Sistemi yeniden başlattıktan sonra docker servislerini çalıştırıyoruz.
Windows PowerShellCopyright (C) Microsoft Corporation. All rights reserved.PS C:\Users\Administrator> $env:path += ";$env:ProgramFiles\docker"PS C:\Users\Administrator>PS C:\Users\Administrator> dockerd --register-servicePS C:\Users\Administrator>PS C:\Users\Administrator> Start-Service dockerPS C:\Users\Administrator>Son olarak docker çalıştırıyoruz.
PS C:\Users\Administrator> docker container run hello-world:nanoserverUnable to find image 'hello-world:nanoserver' locallynanoserver: Pulling from library/hello-world6a5e981230da: Pull completedc4b656f6979: Pull complete2848c5402b33: Pull complete9e0171b11ac8: Pull completeDigest: sha256:ea56d430e69850b80cd4969b2cbb891db83890c7bb79f29ae81f3d0b47a58dd9Status: Downloaded newer image for hello-world:nanoserverHello from Docker!This message shows that your installation appears to be working correctly.To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (windows-amd64, nanoserver-1809) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal.To try something more ambitious, you can run a Windows Server container with: PS C:\> docker run -it mcr.microsoft.com/windows/servercore powershellShare images, automate workflows, and more with a free Docker ID:For more examples and ideas, visit: