Dockerインストール

## Dockerインストール
### 実行環境
![Inked68747470733a2f2f71696974612d696d6167652d73746f72652e73332e61702d6e6f727468656173742d312e616d617a6f6e6177732e636f6d2f302f3131323439342f63613334653666302d363638372d396436652d323736372d6166393530646530353633332e706e6_LI.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/112494/4b94fb79-af6e-5f99-9dce-97ec1b4e522b.jpeg)
### インストール
```terminal
% brew install docker
```
確認

```terminal
% docker -v
% Docker version 19.03.14, build 5eb3275
```
これで行けるかと思ったら。。

```terminal
% docker-compose up
% zsh: command not found: docker-compose
```
docker-composeをインストールしないとだめみたい。。
curlでインストールして、権限を付与する。

```terminal
% sudo curl -L https://github.com/docker/compose/releases/download/1.27.4/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
% sudo chmod +x /usr/local/bin/docker-compose
```
確認

```terminal
% docker-compose -v
docker-compose version 1.27.4, build 40524192
```

無事インストールされたはず。。。
確認

```terminal
% docker-compose up   
Traceback (most recent call last):
  File "site-packages/urllib3/connectionpool.py", line 677, in urlopen
  File "site-packages/urllib3/connectionpool.py", line 392, in _make_request
  File "http/client.py", line 1252, in request
  File "http/client.py", line 1298, in _send_request
  File "http/client.py", line 1247, in endheaders
  File "http/client.py", line 1026, in _send_output
  File "http/client.py", line 966, in send
  File "site-packages/docker/transport/unixconn.py", line 43, in connect
FileNotFoundError: [Errno 2] No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "site-packages/requests/adapters.py", line 449, in send
  File "site-packages/urllib3/connectionpool.py", line 727, in urlopen
  File "site-packages/urllib3/util/retry.py", line 403, in increment
  File "site-packages/urllib3/packages/six.py", line 734, in reraise
  File "site-packages/urllib3/connectionpool.py", line 677, in urlopen
  File "site-packages/urllib3/connectionpool.py", line 392, in _make_request
  File "http/client.py", line 1252, in request
  File "http/client.py", line 1298, in _send_request
  File "http/client.py", line 1247, in endheaders
  File "http/client.py", line 1026, in _send_output
  File "http/client.py", line 966, in send
  File "site-packages/docker/transport/unixconn.py", line 43, in connect
urllib3.exceptions.ProtocolError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "site-packages/docker/api/client.py", line 205, in _retrieve_server_version
  File "site-packages/docker/api/daemon.py", line 181, in version
  File "site-packages/docker/utils/decorators.py", line 46, in inner
  File "site-packages/docker/api/client.py", line 228, in _get
  File "site-packages/requests/sessions.py", line 543, in get
  File "site-packages/requests/sessions.py", line 530, in request
  File "site-packages/requests/sessions.py", line 643, in send
  File "site-packages/requests/adapters.py", line 498, in send
requests.exceptions.ConnectionError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "docker-compose", line 3, in <module>
  File "compose/cli/main.py", line 67, in main
  File "compose/cli/main.py", line 123, in perform_command
  File "compose/cli/command.py", line 69, in project_from_options
  File "compose/cli/command.py", line 132, in get_project
  File "compose/cli/docker_client.py", line 43, in get_client
  File "compose/cli/docker_client.py", line 170, in docker_client
  File "site-packages/docker/api/client.py", line 188, in __init__
  File "site-packages/docker/api/client.py", line 213, in _retrieve_server_version
docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
[31319] Failed to execute script docker-compose
```

たくさんのエラー。。
公式ページからDockerをダウンロードしてみる。とりあえずインストール。
![スクリーンショット 2020-12-31 9.31.53.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/112494/63c96e6b-6bb7-809e-6e7b-c2c98615680d.png)
![スクリーンショット 2020-12-31 9.38.23.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/112494/b6da6166-cae6-368a-a077-c8b83d4d0195.png)

無事起動
なんだったんだ

## 【追記】Homebrew Casksをインストールしてなかったのが原因

```terminal
% brew search docker
==> Casks
alfred			appcleaner		clipy			dropbox			font-hackgen		font-hackgen-nerd	google-chrome		google-drive		google-japanese-ime	iterm2			visual-studio-code
satoru@Mac-mini Curriculum-vitae % brew search docker
==> Formulae
docker ✔                          docker-compose                    docker-credential-helper-ecr      docker-machine                    docker-machine-driver-vmware      docker-machine-nfs                docker-squash                     dockerize
docker-clean                      docker-compose-completion         docker-gen                        docker-machine-completion         docker-machine-driver-vultr       docker-machine-parallels          docker-swarm                      lazydocker
docker-completion                 docker-credential-helper          docker-ls                         docker-machine-driver-hyperkit    docker-machine-driver-xhyve       docker-slim                       docker2aci
==> Casks
docker                                                                                     docker-toolbox
```
1. Casksのdockerを ```brew install --casks docker```
1. Docker Desktopを起動

## まとめ
* 素直に公式サイトでDocker Desktopをインストールしたほうが良い
* Homebrewで管理したかったがために、時間がかかった。。。公式サイトには書いてないよ(;_;)