LoginSignup
5
2

More than 3 years have passed since last update.

Docker for MacのDockerホストにログインする

Last updated at Posted at 2019-06-10

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 ...

psifconfigdf をみると、何やら賑やかです。

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+aky で抜けられます。

5
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
2