Docker for Mac を起動して、Mac から Docker ホストに接続してみます。
Terminal で screen
コマンドを実行します。
screen ~/Library/Containers/com.docker.docker/Data/vms/0/tty
root
でログインできました。Mac なのに Linux が動いています。
Welcome to LinuxKit
## .
## ## ## ==
## ## ## ## ## ===
/"""""""""""""""""___/ ===
{ / ===-
______ O __/
__/
___________/
linuxkit-025000000001 login: root (automatic login)
Welcome to LinuxKit!
NOTE: This system is namespaced.
The namespace you are currently in may not be the root.
System services are namespaced; to access, use `ctr -n services.linuxkit ...
ps
・ifconfig
・df
をみると、何やら賑やかです。
linuxkit-025000000001:~# cat /etc/os-release
PRETTY_NAME="Docker for Mac"
linuxkit-025000000001:~# uname -a
Linux linuxkit-025000000001 4.9.125-linuxkit #1 SMP Fri Sep 7 08:20:28 UTC 2018 x86_64 Linux
linuxkit-025000000001:~# netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 192.168.65.1 0.0.0.0 UG 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
172.19.0.0 0.0.0.0 255.255.0.0 U 0 0 0 br-836bbfxx
172.20.0.0 0.0.0.0 255.255.0.0 U 0 0 0 br-b1063fxx
192.168.32.0 0.0.0.0 255.255.240.0 U 0 0 0 br-8d7390xx
192.168.65.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
linuxkit-025000000001:~# nslookup docker.for.mac.host.internal
Name: docker.for.mac.host.internal
Address 1: 192.168.65.2
linuxkit-025000000001:~# free
total used free shared buffers cached
Mem: 4042244 3404440 637804 1116 422824 2039440
-/+ buffers/cache: 942176 3100068
Swap: 1048572 4 1048568
Docker for Mac の設定画面で、ホスト側のメモリを 4GB、Swap を 1GB に設定した状態なので、それが反映されています。
screen からは control
+a
→k
→y
で抜けられます。