brew install docker 不包含 docker 引擎?

Brew install docker does not include docker engine?

尝试从 brew 设置 docker,但是该引擎似乎并未包含在任何官方公式中。

brew install docker-machine docker-compose

所以这些只安装客户端? engine/daemon没有桶吗?

请尝试运行宁

brew install docker

这将安装 Docker 引擎,这将需要 Docker-Machine (+ VirtualBox) 到 Mac 上的 运行。

如果你想安装 更新的 Docker for Mac, which does not require virtualbox,你可以通过 Homebrew's Cask 安装:

brew install --cask docker 
open /Applications/Docker.app

以下步骤在 macOS Sierra 10.12.4 上运行良好。请注意,在 brew 安装 Docker 之后,docker 命令(符号 link)在 /usr/local/bin 中不可用。 运行 Docker 应用程序首次创建此符号 link。请参阅下面的详细步骤。

  1. 安装Docker.

    brew install --cask docker
    
  2. 启动 Docker。

    • + Space调出Spotlight Search并输入Docker 启动 Docker.
    • Docker需要特权访问对话框中,单击确定
    • 输入密码并单击确定

    当 Docker 以这种方式启动时,Docker 鲸鱼图标会出现在状态菜单中。一旦鲸鱼图标出现,dockerdocker-composedocker-credential-osxkeychaindocker-machine 的符号 link 就会在 /usr/local/bin 中创建。

    $ ls -l /usr/local/bin/docker*
    lrwxr-xr-x  1 susam  domain Users  67 Apr 12 14:14 /usr/local/bin/docker -> /Users/susam/Library/Group Containers/group.com.docker/bin/docker
    lrwxr-xr-x  1 susam  domain Users  75 Apr 12 14:14 /usr/local/bin/docker-compose -> /Users/susam/Library/Group Containers/group.com.docker/bin/docker-compose
    lrwxr-xr-x  1 susam  domain Users  90 Apr 12 14:14 /usr/local/bin/docker-credential-osxkeychain -> /Users/susam/Library/Group Containers/group.com.docker/bin/docker-credential-osxkeychain
    lrwxr-xr-x  1 susam  domain Users  75 Apr 12 14:14 /usr/local/bin/docker-machine -> /Users/susam/Library/Group Containers/group.com.docker/bin/docker-machine
    
  3. 点击状态菜单中的docker鲸鱼图标,等待显示Docker是运行.

  1. 测试 docker 是否正常。

    $ docker run hello-world
    Unable to find image 'hello-world:latest' locally
    latest: Pulling from library/hello-world
    78445dd45222: Pull complete
    Digest: sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7
    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.
     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://cloud.docker.com/
    
    For more examples and ideas, visit:
     https://docs.docker.com/engine/userguide/
    
    $ docker version
    Client:
     Version:      17.03.1-ce
     API version:  1.27
     Go version:   go1.7.5
     Git commit:   c6d412e
     Built:        Tue Mar 28 00:40:02 2017
     OS/Arch:      darwin/amd64
    
    Server:
     Version:      17.03.1-ce
     API version:  1.27 (minimum version 1.12)
     Go version:   go1.7.5
     Git commit:   c6d412e
     Built:        Fri Mar 24 00:00:50 2017
     OS/Arch:      linux/amd64
     Experimental: true
    

要使用自制程序为 Mac 安装 Docker:

brew install homebrew/cask/docker

安装命令行完成:

brew install bash-completion
brew install docker-completion
brew install docker-compose-completion
brew install docker-machine-completion

要重新安装 docker,您应该 运行:

brew reinstall homebrew/cask/docker

Docker 如果您 运行 brew install docker,则不会安装桌面。如果您已经以这种方式安装了它,请先使用 brew uninstall docker.

卸载

要安装 Docker Desktop,运行:

brew install homebrew/cask/docker

从您的 ~/Applications 文件夹启动 docker 一次并输入您的密码,然后您可以 运行 命令如 docker --version 来验证 CLI 是否正常工作。