Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
Help us understand the problem. What is going on with this article?

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

More than 1 year has passed since last update.

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

kawanet
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away