As etapas a seguir funcionam bem no macOS Sierra 10.12.4. Observe que após a instalação do Docker, o docker
comando (link simbólico) não estará disponível em /usr/local/bin
. A execução do aplicativo Docker pela primeira vez cria esse link simbólico. Veja as etapas detalhadas abaixo.
Instale o Docker.
brew cask install docker
Inicie o Docker.
- Pressione ⌘+ Spacepara ativar a Pesquisa Spotlight e digite
Docker
para iniciar o Docker.
- Na caixa de diálogo Docker precisa de acesso privilegiado , clique em OK .
- Digite a senha e clique em OK .
Quando o Docker é iniciado dessa maneira, um ícone da baleia do Docker aparece no menu de status. Assim que as aparece ícone baleia, os links simbólicos para docker
, docker-compose
, docker-credential-osxkeychain
e docker-machine
são criados no /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
Clique no ícone da baleia de encaixe no menu de status e aguarde até que o Docker esteja em execução .
Teste se a janela de encaixe funciona bem.
$ 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
Se você for usar docker-machine
para criar máquinas virtuais, instale o VirtualBox.
brew cask install virtualbox
Observe que, se o VirtualBox não estiver instalado, docker-machine
falhará com o seguinte erro.
$ 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"