Brew安装docker不包括docker引擎?

时间:2016-11-10 08:47:38

标签: macos docker homebrew

尝试从brew安装docker,但引擎似乎不包含在任何官方公式中。

brew install docker-machine docker-compose

所以这些只安装客户端? 引擎/守护进程没有桶吗?

4 个答案:

答案 0 :(得分:232)

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

  1. 安装Docker。

    brew cask install docker
    
  2. 启动Docker。

    • 按Command + Space以显示 Spotlight搜索并输入Docker以启动Docker。
    • Docker需要特权访问对话框中,单击确定
    • 输入密码,然后单击确定

    以这种方式启动Docker时,状态菜单中会出现Docker whale图标。只要显示鲸鱼图标,就会在docker中创建docker-composedocker-credential-osxkeychaindocker-machine/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 whale图标,等待它显示 Docker正在运行

    enter image description here enter image description here

  4. 测试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
    
  5. 如果您要使用docker-machine创建虚拟机,请安装VirtualBox。

    brew cask install virtualbox
    

    请注意,如果未安装VirtualBox,则docker-machine 因以下错误而失败。

    $ docker-machine create manager
    Running pre-create checks...
    Error with pre-create check: "VBoxManage not found. Make sure VirtualBox is installed and VBoxManage is in the path"
    

答案 1 :(得分:137)

请尝试运行

brew install docker

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

如果你想安装较新的Docker for Mac does not require virtualbox,你可以通过Homebrew的Cask安装它:

brew cask install docker

答案 2 :(得分:24)

使用自制软件安装Docker for Mac:

brew cask install docker

安装命令行完成:

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

答案 3 :(得分:0)

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

brew reinstall homebrew/cask/docker