Установка docker md

Using Docker on Windows 10 (Updated at the end of 2019)

Since I wrote this originally, Docker on Windows has become a first-class supported tool, with a Windows Installer and well-documented installation processes from docker and from Microsoft.

Today, I actually install docker using boxstarter scripts where I can Enable-WindowsOptionalFeature -Online -FeatureName containers -All and then choco upgrade -y docker-desktop as well as installing tooling for VS Code code --install-extension "ms-azuretools.vscode-docker".

I’ve left the rest of these notes here as a historical record, more than anything else. You should not expect the script below to work, but you certainly don’t need it, since you can install via the installer or automate with docker desktop on chocolatey or the PackageManagement Docker Provider, and the PowerShell team now publishes official PowerShell Docker images for Debian and Ubuntu, CentOS and Fedora, OpenSuse, and Alpine, as well as Windows NanoServer and Server Core over on docker hub.

The original blog post

There are a lot of good reasons to use Docker. Right now, my reason is that I need to work with PowerShell on Linux, and with Windows 10 anniversary update, Windows containers now support Nano Server as well (which is the other logical place to test the new open source PowerShell).

Currently, Docker supports running Linux images or Windows images in their container service, but not both in the same server, so to get both, we need to first install Docker using the installer, (which handles dependencies like requiring Hyper-V and Containers) and then install the most recent version of the Windows service separately, and configure them to run together.

:/>  Непрерывный писк спикера

Start by installing the Linux Container server

Here’s a full explanation, but you could just run the whole script and then skip to installing nanoserver

NOTE: All of these commands should be run from an elevated host.

 InstallDocker.msi# Personally, I like BITS: Start-BitsTransfer https://download.docker.com/win/stable/InstallDocker.msi -Destination $DockerInstaller https:winstableInstallDocker.msi OutFile # Now install it msiexec i quiet

Install the Windows Container server

To support Windows images (including Nano Server) in docker, we need the separate service, which currently means we need the very latest release of the docker service for windows containers. Note that this command writes directly to Program Files, since we’re elevated.

 OutFile 

We need to manually register the service for that one, and to specify an alternate pipe address to listen on. I also like to customize the service name (by default it’s just “docker”) so that it matches the one set by the Linux engine.

 H npipe:.pipewin_engine servicenamecom.docker.windows 

Make sure that Containers work

 Online FeatureName MicrosoftHyperV Containers All

If you’ve played with Windows docker previously, and disabled Oplocks, you should enable them again now. If you didn’t, there’s no need to worry about this.

 Path Name VSmbDisableOplocks Type DWord Value Force

In fact, to make sure I can tell them apart, I like to customize the display text so I can remember which is which:

 HKLM:\SYSTEM\CurrentControlSet\Services\com.docker.windows DisplayName Docker Engine for Windows HKLM:\SYSTEM\CurrentControlSet\Services\com.docker.windows Description Windows Containers Server for Docker HKLM:\SYSTEM\CurrentControlSet\Services\com.docker.service DisplayName Docker Engine for Linux HKLM:\SYSTEM\CurrentControlSet\Services\com.docker.service Description Linux Containers Server For Docker

Install the Docker PowerShell module

For PowerShell support, there is a Docker module, so we can avoid parsing the output of docker ps -a every time we need to know the name or id of a running image. However, it’s also still in pre-release, so you have to install it from it’s appveyor feed:

 Name DockerPSDev SourceLocation https:nugetdockerpowershelldev Docker Repository DockerPSDev Force

You should not even need to reboot, just start the windows service(s).

 com.docker Passthru

Multiple Docker Services

ScreenShot of docker version

We actually have two Docker services (aka daemons) running, so we can run Linux or Windows docker containers. However, whenever we want to use the second one, we have to provide the host address.

:/>  Не работает тачпад на ноутбуке ASUS Windows 10: что делать и как исправить

Eventually, Microsoft and Docker will get this worked out so they can all play together and we won’t need two services on Windows, but in the meantime, it’s not that big of a deal, because we can just put the parameter in a hashtable and splat it each time.

Installing NanoServer

For instance, here’s how to get a simple image for each:

 { } microsoftnanoserver ubuntu

And to set up nano and remote into it, using the same $dw hashtable:

 microsoftnanoserver Passthru interestingly, New-PSSession didn't need me to tell it about the host: Name Nano ContainerId 

If you forget to specify the HostAddress, you’ll just get errors because the container or image isn’t available on the other service.

Installing PowerShell on Ubuntu

Since we’ve gone ahead and installed an ubuntu image, and we’re die-hard PowerShellers, we really need that Enter-PSSession functionality for ubuntu, right?

 ubuntu Input Terminal name psu Passthru aptget update aptget install libicu55 libunwind8 download here and push in, just to show how: https:PowerShellPowerShellreleasesdownloadv6.alpha.powershell_6.alpha.1ubuntu1..1_amd64.deb OutFile ~Downloadspowershell_6.alpha.1ubuntu1..1_amd64.deb ~Downloadspowershell_6.alpha.1ubuntu1..1_amd64.deb Destination home ToContainer  Install it using dpkg -i dpkg homepowershell_6.alpha.1ubuntu1..1_amd64.deb

And that’s it. You can now run PowerShell on your Ubuntu host. I’ve had to do so using the actual docker exec command rather than Start-ContainerProcess, because

Currently the Docker module locks up the host when it goes interactive.

docker exec -it psu powershell

Remember, Ctrl+P, Ctrl+Q to get out, and to get back in:

docker attach psu