-
可以用Docker命令docker ps,列出所有正在執行的Linux或Windows容器。
-
在容器和主機之間透過儲存捲共享資料。
-
容器之間可以透過容器網路互相通訊。
-
透過將埠對映到主機,實現本地訪問。但目前,它還只是Windows 10 1803版預覽體驗計劃(Windows Insider)的一項功能。
docker pull --platform linux alpine
docker run alpine uname -a
cd \
mkdir host
docker run -it -v C:\host:\test alpine sh
uname -a > test/hello-from-linux.txt
docker run -i -v C:\host:C:\test microsoft/nanoserver:1709 cmd
ver > test\hello-from-windows.txt
PS C:\> dir host
Directory: C:\host
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 1/21/2018 4:32 AM 85 hello-from-linux.txt
-a---- 1/21/2018 4:33 AM 46 hello-from-windows.txt
version: "3.2"
services:
web1:
image: nginx
volumes:
- type: bind
source: C:\host
target: /test
ports:
- 80:80
web2:
image: stefanscherer/hello-dresden:0.0.3-windows-1709
volumes:
- type: bind
source: C:\host
target: C:\test
ports:
- 81:3000
networks:
default:
external:
name: nat
Enable-WindowsOptionalFeature -Online -FeatureName containers -All -NoRestart
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All -NoRestart
Invoke-WebRequest -OutFile "$env:TEMP\linuxkit-lcow.zip" "https://23-111085629-gh.circle-artifacts.com/0/release.zip"
Expand-Archive -Path "$env:TEMP\linuxkit-lcow.zip" -DestinationPath "$env:ProgramFiles\Linux Containers" -Force
Invoke-WebRequest -OutFile "$env:TEMP\docker-master.zip" "https://master.dockerproject.com/windows/x86_64/docker.zip"
Expand-Archive -Path "$env:TEMP\docker-master.zip" -DestinationPath $env:ProgramFiles -Force
. $env:ProgramFiles\docker\dockerd.exe --register-service --experimental
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";$($env:ProgramFiles)\docker", [EnvironmentVariableTarget]::Machine)
git clone https://github.com/StefanScherer/docker-windows-box
cd docker-windows-box
cd lcow
vagrant up
-
https://github.com/moby/moby/pull/34859
-
https://github.com/linuxkit/lcow/releases
-
https://twitter.com/stefscherer