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

brew install docker-machine docker-compose

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


当前回答

以下步骤在macOS Sierra 10.12.4上运行正常。注意,在brew安装Docker后,Docker命令(符号链接)在/usr/local/bin中不可用。第一次运行Docker应用程序会创建这个符号链接。请参阅下面的详细步骤。

Install Docker. brew install --cask docker Launch Docker. Press ⌘ + Space to bring up Spotlight Search and enter Docker to launch Docker. In the Docker needs privileged access dialog box, click OK. Enter password and click OK. When Docker is launched in this manner, a Docker whale icon appears in the status menu. As soon as the whale icon appears, the symbolic links for docker, docker-compose, docker-credential-osxkeychain and docker-machine are created in /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 Click on the docker whale icon in the status menu and wait for it to show Docker is running.

Test that docker works fine. $ 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

其他回答

为了重新安装docker,你应该运行:

brew reinstall homebrew/cask/docker

使用自制软件安装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

如果运行brew install Docker,将不会安装Docker桌面。如果你已经用这种方式安装了它,首先用brew卸载docker卸载。

安装Docker Desktop,运行:

brew install homebrew/cask/docker

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

Mac版Docker桌面版对于企业Docker用户来说不是一个合适的选择,因为它需要付费许可证才能使用。牧场主桌面是一个可行的开源替代Docker桌面所有三个主要的操作系统。

由于这个问题是专门针对Mac OS用户的,所以我添加了使其在Mac OS上工作的步骤。

首先使用自制软件安装Docker。 Brew安装docker 安装牧场主桌面。 在Kubernates Settings中,将容器运行时更改为dockerd。

利润!

更新:场景中还有另一个开源容器运行时,名为Colima (https://github.com/abiosoft/colima)。

以下步骤在macOS Sierra 10.12.4上运行正常。注意,在brew安装Docker后,Docker命令(符号链接)在/usr/local/bin中不可用。第一次运行Docker应用程序会创建这个符号链接。请参阅下面的详细步骤。

Install Docker. brew install --cask docker Launch Docker. Press ⌘ + Space to bring up Spotlight Search and enter Docker to launch Docker. In the Docker needs privileged access dialog box, click OK. Enter password and click OK. When Docker is launched in this manner, a Docker whale icon appears in the status menu. As soon as the whale icon appears, the symbolic links for docker, docker-compose, docker-credential-osxkeychain and docker-machine are created in /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 Click on the docker whale icon in the status menu and wait for it to show Docker is running.

Test that docker works fine. $ 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