This is about the installation of the Docker in the Nano Server VM which has been created in my previous article.
Step 1 Connecting to Nano Server using PowerShell
- Open PowerShell with administrator privileges. Run the following code to connect with the Nano Server.
Enter-PSSession -ConnectionUri "https://nanoserver007.southindia.cloudapp.azure.com:5986/WSMAN" -Credential (Get-Credential)
- This will ask you for the username and password of the Nano Server VM. Enter them and login.
- After logging in, you will be allowed to access the Nano Server using PowerShell. You will find some change like this.
Step 2 Checking Windows Updates for Nano Server
- It is necessary to update the VM before installing Docker. Hence, we have to update Windows before installing Docker. For this, run the following set of commands.
$sess = New-CimInstance -Namespace root/Microsoft/Windows/WindowsUpdate -ClassName MSFT_WUOperationsSession
Invoke-CimMethod -InputObject $sess -MethodName ApplyApplicableUpdates
- This will take some time to finish updates. You have to wait for a few minutes to get the updates to finish up. After the updates are done, we need to restart the Server. Run the following command after the updates are done.
Restart-Computer
- After restarting the Nano Server, again, connect back to the VM and login with the credentials.
Step 3 Installing Docker
- After logging into the VM, install the Docker Service using the following command.
Install-Module -Name DockerMsftProvider -Repository PSGallery -Force
- Now, install the docker package from the gallery which we have installed.
Install-Package -Name docker -Providername DockerMsftProvider -Verbose
- Once the installation gets done, restart your Server VM by running the following command.
Restart-Computer -Force
Step 4 Starting Docker
- Now, check whether Docker is running or not, by using this command.
Get-Service docker
- If it doesn’t run, execute the following command.
Start-Service docker
- Now, execute the command.
docker version
Finally, Docker has been successfully installed in the Nano Server VM.