| 1 |
# Operating System Specific |
| 2 |
|
| 3 |
## Windows |
| 4 |
|
| 5 |
Under Windows, we assume Docker for Windows is installed since this ships with a suitably patched Linux kernel (though the tests can also be run to a Windows VM). Currently, there is also the restriction that one can only connect from the host to the (Linux) VM. |
| 6 |
|
| 7 |
First register the Hyper-V socket GUID in the registry. Follow the instructions on [making an integration service](https://docs.microsoft.com/en-gb/virtualization/hyper-v-on-windows/user-guide/make-integration-service): |
| 8 |
|
| 9 |
- create a new registry key (e.g. with `regedit.exe`) called `3049197C-FACB-11E6-BD58-64006A7986D3` under `HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Virtualization\GuestCommunicationServices` |
| 10 |
- inside the new key create a String value called `ElementName`. The Data can be anything you like but typically this is a description such as "sock_stress". |
| 11 |
|
| 12 |
Next build a Linux container with the test program as shown below. |
| 13 |
|
| 14 |
## Linux |
| 15 |
|
| 16 |
After building the binary can be run from a suitably privileged |
| 17 |
container: |
| 18 |
|
| 19 |
$ cat >Dockerfile <<EOF |
| 20 |
FROM alpine |
| 21 |
RUN apk update && apk add strace |
| 22 |
ADD sock_stress.linux /sock_stress |
| 23 |
ENTRYPOINT ["/sock_stress"] |
| 24 |
EOF |
| 25 |
$ docker build -t stress . && docker run -it --rm --net=host --privileged stress [...options...] |
| 26 |
|
| 27 |
## MacOS |
| 28 |
|
| 29 |
Under MacOS the default is to assume Hyperkit as configured by Docker |
| 30 |
for Mac (since the path to the sockets and the names of the sockets |
| 31 |
themselves differ). |
| 32 |
|
| 33 |
To run against standalone Hyperkit the path to the sockets must be |
| 34 |
specified when starting Hyperkit and must be passed to the option: |
| 35 |
|
| 36 |
macos$ ./sock_stress.darwin -s vsock -m hyperkit:/var/run/ |
| 37 |
|
| 38 |
(this assumes hyperkit was built without `PRI_ADDR_PREFIX` or |
| 39 |
`CONNECT_SOCKET_NAME` set at build time and run with e.g. `-s |
| 40 |
7,virtio-sock,guest_cid=3,path=/var/run`) |
| 41 |
|
| 42 |
In Docker mode everything is implied to be as it is configured by |
| 43 |
Docker for Mac. This is the default but can be given explicitly with: |
| 44 |
|
| 45 |
macos$ ./sock_stress.darwin -s vsock -m docker |
| 46 |
|
| 47 |
# Specific OS Pairs |
| 48 |
|
| 49 |
## Linux & Docker for Windows |
| 50 |
|
| 51 |
Start the linux container with program in server mode: |
| 52 |
|
| 53 |
PS> docker run -it --rm --net=host --privileged stress -s hvsock |
| 54 |
|
| 55 |
The start the client in a separate powershell window: |
| 56 |
|
| 57 |
PS> $vmId = (Get-VM MobyLinuxVM).Id |
| 58 |
PS> .\sock_stress.exe -c hvsock://$vmId |
| 59 |
|
| 60 |
|
| 61 |
## Linux & Docker for Mac |
| 62 |
|
| 63 |
When running as a client on the Linux side the correct address is cid |
| 64 |
"2" (the host): |
| 65 |
|
| 66 |
linux$ docker run -it --rm --net=host --privileged stress -c vsock://2 |
| 67 |
macos$ ./sock_stress.darwin -s vsock |
| 68 |
|
| 69 |
When running as a client on the MacOS side the correct address is cid |
| 70 |
is "3" (the guest, as configued by Docker for Mac): |
| 71 |
|
| 72 |
linux$ docker run -it --rm --net=host --privileged stress -s vsock |
| 73 |
macos$ ./sock_stress.darwin -c vsock://3 |