【動いてないです】WSL@1809 でDockerを動かすためのメモ

# Win10@1809 + Ubuntu18.04ではDockerが動かないらしいですね
- いろいろ試してみましたがdockerdまでは動きました
- docker runで死ぬ
- containerd.ioを操作してみたけど死ぬ

# dockerdを動かす
```shell
$ sudo vim /etc/default/docker
DOCKER_OPTS="--bridge=none --iptables=false --tls=false"

# sudo cgroupfs-mount # 自動でやってくれてる
$ sudo /etc/init.d/docker start
$ sudo docker version
~ 省略 ~ 
$ sudo docker info
~ 省略 ~ 
$ sudo docker run hello-world
docker: Error response from daemon: OCI runtime create failed: container_linux.go:344: starting container process caused "process_linux.go:297: getting the final child's pid from pipe caused \"EOF\"": unknown.
ERRO[0000] error waiting for container: context canceled
```

```/var/log/docker.io
time="2019-03-27T23:15:30.964731800+09:00" level=warning msg="Seccomp is not enabled in your kernel, running container without default profile."
time="2019-03-27T23:15:31.043117200+09:00" level=info msg="shim containerd-shim started" address="/containerd-shim/moby/6e5818fab85b97c64699a5e2ef1fa1aa263db787ff4404e1ee0b3febbb122a34/shim.sock" debug=false pid=477
time="2019-03-27T23:15:31.174600900+09:00" level=info msg="shim reaped" id=6e5818fab85b97c64699a5e2ef1fa1aa263db787ff4404e1ee0b3febbb122a34
time="2019-03-27T23:15:31.190734000+09:00" level=error msg="stream copy error: reading from a closed fifo"
time="2019-03-27T23:15:31.190792100+09:00" level=error msg="stream copy error: reading from a closed fifo"
time="2019-03-27T23:15:31.222245400+09:00" level=error msg="6e5818fab85b97c64699a5e2ef1fa1aa263db787ff4404e1ee0b3febbb122a34 cleanup: failed to delete container from containerd: no such container"
time="2019-03-27T23:15:31.222357100+09:00" level=error msg="Handler for POST /v1.39/containers/6e5818fab85b97c64699a5e2ef1fa1aa263db787ff4404e1ee0b3febbb122a34/start returned error: OCI runtime create failed: container_linux.go:344: starting container process caused \"process_linux.go:297: getting the final child's pid from pipe caused \\\"EOF\\\"\": unknown"
```

## docker version
```
$ sudo docker version
Client:
 Version:           18.09.3
 API version:       1.39
 Go version:        go1.10.8
 Git commit:        774a1f4
 Built:             Thu Feb 28 06:53:11 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.3
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.8
  Git commit:       774a1f4
  Built:            Thu Feb 28 05:59:55 2019
  OS/Arch:          linux/amd64
  Experimental:     false
```

# docker info
```
$ sudo docker info
Containers: 1
 Running: 0
 Paused: 0
 Stopped: 1
Images: 1
Server Version: 18.09.3
Storage Driver: overlay2
 Backing Filesystem: <unknown>
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: N/A
runc version: 6635b4f0c6af3810594d2770f662f34ddc15b40d
init version: fec3683
Kernel Version: 4.4.0-17763-Microsoft
Operating System: Ubuntu 18.04.2 LTS
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 15.97GiB
Name: DESKTOP-GM6MUIU
ID: UUTN:SO5Q:FMA4:P33X:TFXM:WVFZ:PF7P:VDFW:5MT6:5V6L:OTEH:O2SN
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine

WARNING: No memory limit support
WARNING: No swap limit support
WARNING: No kernel memory limit support
WARNING: No oom kill disable support
WARNING: No cpu cfs quota support
WARNING: No cpu cfs period support
WARNING: No cpu shares support
WARNING: No cpuset support
```

# docker runで死んだ

```shell
$ sudo docker run hello-world
docker: Error response from daemon: OCI runtime create failed: container_linux.go:344: starting container process caused "process_linux.go:297: getting the final child's pid from pipe caused \"EOF\"": unknown.
ERRO[0000] error waiting for container: context canceled
```


# ctr で死んだ
```
♯ 別窓 & rootで実行
# containerd

# ctr image pull docker.io/library/redis:latest
docker.io/library/redis:latest:                                                   resolved       |++++++++++++++++++++++++++++++++++++++|
index-sha256:e09c533359fca9039ac943fec0dc3a212897582e66859853c808351b2eb47e09:    done           |++++++++++++++++++++++++++++++++++++++|
manifest-sha256:478392fbb4f132b36b8ead3435087553ee7e6f0395b3d64987ae195268d13493: exists         |++++++++++++++++++++++++++++++++++++++|
layer-sha256:cfbdd870cf756e661412595b81f9b819efc6c16a4c8f19858091d873e72588ed:    done           |++++++++++++++++++++++++++++++++++++++|
layer-sha256:cde8019a4b43a4c7fb70ef830196d12a8ba0d031add8e93c3853685b60146393:    done           |++++++++++++++++++++++++++++++++++++++|
config-sha256:a55fbf438dfd878424c402e365ef3d80c634f07d0f5832193880ee1b95626e4e:   done           |++++++++++++++++++++++++++++++++++++++|
layer-sha256:39c8f5ba1240221350872c51b65a0bd1944a5dcc735fddbe132ff565afcba704:    done           |++++++++++++++++++++++++++++++++++++++|
layer-sha256:c6fe0dfbb7e3e8e6828b7e292526ac875639aaeeb98ad2f4bb89b9cedaa1645d:    done           |++++++++++++++++++++++++++++++++++++++|
layer-sha256:97a473b37fb2921176dcdeb10cecd0171a8b2ef20ea51fcbf330a8ccd9c7efb3:    done           |++++++++++++++++++++++++++++++++++++++|
layer-sha256:27833a3ba0a545deda33bb01eaf95a14d05d43bf30bce9267d92d17f069fe897:    done           |++++++++++++++++++++++++++++++++++++++|
elapsed: 3.9 s                                                                    total:  2.3 Ki (607.0 B/s)            
unpacking linux/amd64 sha256:e09c533359fca9039ac943fec0dc3a212897582e66859853c808351b2eb47e09...
done
♯ 死ぬ時と死なない時がある

# ctr run -d docker.io/library/redis:latest redis1
ctr: OCI runtime create failed: container_linux.go:344: starting container process caused "process_linux.go:297: getting the final child's pid from pipe caused \"EOF\"": unknown
```

```
# ctr  plugins ls
TYPE                            ID                    PLATFORMS      STATUS
io.containerd.content.v1        content               -              ok
io.containerd.snapshotter.v1    btrfs                 linux/amd64    error
io.containerd.snapshotter.v1    aufs                  linux/amd64    error
io.containerd.snapshotter.v1    native                linux/amd64    ok
io.containerd.snapshotter.v1    overlayfs             linux/amd64    ok
io.containerd.snapshotter.v1    zfs                   linux/amd64    error
io.containerd.metadata.v1       bolt                  -              ok
io.containerd.differ.v1         walking               linux/amd64    ok
io.containerd.gc.v1             scheduler             -              ok
io.containerd.service.v1        containers-service    -              ok
io.containerd.service.v1        content-service       -              ok
io.containerd.service.v1        diff-service          -              ok
io.containerd.service.v1        images-service        -              ok
io.containerd.service.v1        leases-service        -              ok
io.containerd.service.v1        namespaces-service    -              ok
io.containerd.service.v1        snapshots-service     -              ok
io.containerd.runtime.v1        linux                 linux/amd64    ok
io.containerd.runtime.v2        task                  linux/amd64    ok
io.containerd.monitor.v1        cgroups               linux/amd64    ok
io.containerd.service.v1        tasks-service         -              ok
io.containerd.internal.v1       restart               -              ok
io.containerd.grpc.v1           containers            -              ok
io.containerd.grpc.v1           content               -              ok
io.containerd.grpc.v1           diff                  -              ok
io.containerd.grpc.v1           events                -              ok
io.containerd.grpc.v1           healthcheck           -              ok
io.containerd.grpc.v1           images                -              ok
io.containerd.grpc.v1           leases                -              ok
io.containerd.grpc.v1           namespaces            -              ok
io.containerd.internal.v1       opt                   -              ok
io.containerd.grpc.v1           snapshots             -              ok
io.containerd.grpc.v1           tasks                 -              ok
io.containerd.grpc.v1           version               -              ok
```

# 関係ありそうなところ
- [runc@v1.0.0-rc6/libcontainer/process_linux.go](https://github.com/opencontainers/runc/blob/ccb5efd37fb7c86364786e9137e22948751de7ed/libcontainer/process_linux.go#L297)
- [BoltDB panics on cursor search since April update · Issue #3162 · Microsoft WSL](https://github.com/Microsoft/WSL/issues/3162)

# 参考
- [containerd v1\.1\.2を動かして色々操作してみた \- etogenのブログ](https://etogen.hatenablog.com/entry/2018/07/30/220805)