MEMO: Veertu の CoreOS をホストから使えるように設定する

### まず、デフォルトユーザの `core` にパスワードを設定する。

```bash
core@localhost ~ $ sudo passwd core
```

### IP アドレスを調べて SSH でログインする。

```bash
core@localhost ~ $ ifconfig ens3
ens3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.64.8  netmask 255.255.255.0  broadcast 192.168.64.255
        inet6 fe80::746d:78ff:fe7c:ddd8  prefixlen 64  scopeid 0x20<link>
        ether 76:6d:78:7c:dd:d8  txqueuelen 1000  (Ethernet)
        RX packets 442  bytes 47346 (46.2 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 372  bytes 52894 (51.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
```

```bash
$ ssh core@192.168.64.8  -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no
core@192.168.64.8's password:
Last login: Thu Jan  7 15:32:37 2016
CoreOS stable (766.5.0)
Update Strategy: No Reboots
core@localhost ~ $ 
```

### 次に Docker の設定

```bash
core@localhost ~ $ cat /etc/systemd/system/docker-tcp.socket
[Unit]
Description=Docker Socket for the API

[Socket]
ListenStream=2375
Service=docker.service
BindIPv6Only=both

[Install]
WantedBy=sockets.target
core@localhost ~ $ sudo systemctl stop docker
core@localhost ~ $ sudo systemctl start docker-tcp.socket
core@localhost ~ $ sudo systemctl start docker

```

```bash
$ export DOCKER_HOST=tcp://192.168.64.8:2375
$ docker info
Error response from daemon: client is newer than server (client API version: 1.21, server API version: 1.19)
```

(ﾟдﾟ)!

### 気を取り直して、alpha チャンネルの最新版をディスクにインストールする。

*) ここでは Vagrant 用の SSH キーを使用しました。

```bash
core@localhost ~ $ cat cloud-config.yml
#cloud-config

ssh_authorized_keys:
  - ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key

coreos:
  units:
    - name: docker-tcp.socket
      command: start
      runtime: no
      content: |
        [Unit]
        Description=Docker Socket for the API
        [Socket]
        ListenStream=2375
        Service=docker.service
        BindIPv6Only=both
        [Install]
        WantedBy=sockets.target

    - name: docker.service
      command: start
core@localhost ~ $ sudo coreos-install -d /dev/sda -V current -C alpha -c cloud-config.yml
core@localhost ~ $ sudo reboot
```

```bash
$ ssh core@192.168.64.8 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i ~/.vagrant.d/insecure_private_key
CoreOS alpha (899.1.0)
core@localhost ~ $ 
```

```bash
$ export DOCKER_HOST=tcp://192.168.64.8:2375
$ docker info
Containers: 0
Images: 0
Server Version: 1.9.1
Storage Driver: overlay
 Backing Filesystem: extfs
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 4.3.3-coreos
Operating System: CoreOS 899.1.0
CPUs: 1
Total Memory: 997.5 MiB
Name: localhost
ID: Y7IJ:FYUN:5JUZ:KYG6:GBIA:JLCP:JJ7R:237W:RFFT:GGIF:K34F:7I53
Username: ailispaw
Registry: https://index.docker.io/v1/
```

(ﾟ∀ﾟ)ｷﾀｺﾚ!!