Macbookにdockerを入れたのに、ターミナルでdockerが認識されない！そんな時は、open /Applications/Docker.appで表示されるGUI画面で「開く」=>「インストール」を押すと解決する！


#*cask install*でDockerを入れる

```bash:Terminal
% brew cask install docker
Error: Calling brew cask install is disabled! Use brew install [--cask] instead.
ocean@AfoGuardMacBook-Pro ~ %
```

__*brew cask install docker*__ではなく、__*brew install --cask docker*__と入力しろ、といわれた。
 
 ```bash:Terminal
ocean@AfoGuardMacBook-Pro ~ % brew install --cask docker
==> Downloading https://desktop.docker.com/mac/stable/51017/Docker.dmg
######################################################################## 100.0%
==> Installing Cask docker
==> Moving App 'Docker.app' to '/Applications/Docker.app'.
🍺  docker was successfully installed!
ocean@AfoGuardMacBook-Pro ~ %
```

#*docker*コマンドが認識されない（パスが通っていない？）

```bash:Terminal
ocean@AfoGuardMacBook-Pro ~ % docker -v
zsh: command not found: docker
ocean@AfoGuardMacBook-Pro ~ %
```

```bash:Terminal
ocean@AfoGuardMacBook-Pro ~ % which docker
docker not found
ocean@AfoGuardMacBook-Pro ~ % 
 ```
 
 - [@atahiroさん「Homebrewを使ってDockerをMacにインストール」](https://qiita.com/atahiro/items/61e826b4cb2387bcd226)

> あれ？エラーが出る。インストールできてない？
> アプリを起動してみた
> open /Applications/Docker.app
>
>何やらMacの管理PWを聞かれるので入力。
>できたっぽいので再度確認。

@atahiroさんの上の記述を参考にする。

 ```bash:Terminal
ocean@AfoGuardMacBook-Pro ~ % open /Applications/Docker.app
```

- __GUIの小画面が出現した。__
- __「インストール」をクリックする。__

その後、Terminalで__*which docker*__と打つと、__*docker*__が認識された。

 ```bash:Terminal
ocean@AfoGuardMacBook-Pro ~ % which docker
/usr/local/bin/docker
ocean@AfoGuardMacBook-Pro ~ %
```

 ```bash:Terminal
ocean@AfoGuardMacBook-Pro ~ % docker --version
Docker version 20.10.0, build 7287ab3
ocean@AfoGuardMacBook-Pro ~ %
```

 ```bash:Terminal
ocean@AfoGuardMacBook-Pro ~ % docker ps
Error response from daemon: dial unix docker.raw.sock: connect: no such file or directory
ocean@AfoGuardMacBook-Pro ~ %
```

__*docker run hello-world*__も実行成功

```bash:Terminal 
ocean@AfoGuardMacBook-Pro ~ % docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
0e03bdcc26d7: Pull complete 
Digest: sha256:1a523af650137b8accdaed439c17d684df61ee4d74feac151b5b337bd29e7eec
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

ocean@AfoGuardMacBook-Pro ~ %
```

 ```bash:Terminal 
ocean@AfoGuardMacBook-Pro ~ % docker images
REPOSITORY    TAG       IMAGE ID       CREATED         SIZE
hello-world   latest    bf756fb1ae65   12 months ago   13.3kB
ocean@AfoGuardMacBook-Pro ~ %