1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

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

Last updated at Posted at 2020-12-28

#cask installでDockerを入れる

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__と入力しろ、といわれた。

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コマンドが認識されない(パスが通っていない?)

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

あれ?エラーが出る。インストールできてない?
アプリを起動してみた
open /Applications/Docker.app

何やらMacの管理PWを聞かれるので入力。
できたっぽいので再度確認。

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

Terminal
ocean@AfoGuardMacBook-Pro ~ % open /Applications/Docker.app
  • GUIの小画面が出現した。
  • 「インストール」をクリックする。

その後、Terminalで__which dockerと打つと、docker__が認識された。

Terminal
ocean@AfoGuardMacBook-Pro ~ % which docker
/usr/local/bin/docker
ocean@AfoGuardMacBook-Pro ~ %
Terminal
ocean@AfoGuardMacBook-Pro ~ % docker --version
Docker version 20.10.0, build 7287ab3
ocean@AfoGuardMacBook-Pro ~ %
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__も実行成功

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 ~ %
Terminal
ocean@AfoGuardMacBook-Pro ~ % docker images
REPOSITORY    TAG       IMAGE ID       CREATED         SIZE
hello-world   latest    bf756fb1ae65   12 months ago   13.3kB
ocean@AfoGuardMacBook-Pro ~ % 
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?