2016-11-10 48 views

回答

30

請嘗試運行

brew install docker 

這將安裝多克爾引擎,這將需要多克 - 機(+ VirtualBox的)在Mac上運行。

如果要安裝新Docker for Mac,您可以安裝自制通過的木桶:

brew cask install docker 
+1

'泊塢窗,撰寫' 上只是給了我:一個錯誤 「您可能需要運行碼頭機啓動默認設置」 我不想爲我的容器運行虛擬框,我想在我的mac上本地運行它 –

+2

我已更新我的答案,以顯示如何安裝Docker for Mac,它不需要VirtualBox或Docker-Machine。 – nwinkler

+0

我可以看到,這給了我整個桌面應用程序。沒有辦法只獲得守護進程+ cli工具,我想在「無頭」OSX上運行它。 –

54

以下步驟工作在MacOS塞拉利昂10.12.4罰款。請注意,在brew安裝Docker之後,docker命令(符號鏈接)在/usr/local/bin上不可用。第一次運行Docker應用程序創建了這個符號鏈接。請參閱下面的詳細步驟。

  1. 安裝Docker。

    brew cask install docker 
    
  2. 啓動Docker。

    • 按Command +空格鍵彈出Spotlight搜索並輸入Docker推出泊塢窗。
    • Docker需要特權訪問對話框,點擊確定
    • 輸入密碼並點擊確定

    當以這種方式啓動Docker時,狀態菜單中會出現一個Docker鯨魚圖標。只要出現鯨魚圖標,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. 點擊在狀態菜單中的泊塢窗鯨魚圖標,等待它顯示碼頭工人正在運行

    enter image description here enter image description here

  4. 測試是碼頭工人正常工作。

    $ 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" 
    
+2

不能更清楚,thx! – herve

+1

這個答案的最好的部分是作者提供了額外的信息,讓那些對他們的計算機有強迫症的人(比如我)感到放心。謝謝! – dawnstar

+1

詳細解釋。 – forethought

3

要使用自制軟件的Mac安裝泊塢窗:

brew cask install docker 

要安裝的命令行完成:

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