您的位置:首页 > 运维架构 > Docker

docker(二):Mac docker hello-world

2017-05-18 14:31 330 查看
终端按顺序执行如下命令:

su root//切换为root账户


sudo env//下面使用root进行操作


boot2docker init//初始化虚拟机,包括虚拟机镜像下载


保证虚拟机电源开启

boot2docker up//把虚拟机打开


出现如下信息:

**

WARNING: The ‘boot2docker’ command line interface (not to be confused with

‘boot2docker’ the operating system) is officially deprecated.

Please switch to Docker Machine (https://docs.docker.com/machine/) ASAP.

Docker Toolbox (https://docker.com/toolbox) is the recommended install method.

Waiting for VM and Docker daemon to start…

Writing /Users/jinx/.boot2docker/certs/boot2docker-vm/ca.pem

Writing /Users/jinx/.boot2docker/certs/boot2docker-vm/cert.pem

Writing /Users/jinx/.boot2docker/certs/boot2docker-vm/key.pem

To connect the Docker client to the Docker daemon, please set:

export DOCKER_HOST=tcp://192.168.59.103:2376

export DOCKER_CERT_PATH=/Users/jinx/.boot2docker/certs/boot2docker-vm

export DOCKER_TLS_VERIFY=1

Or run:
eval "$(boot2docker shellinit)"


**

docker默认账户密码为:tcuser

eval "$(boot2docker shellinit)"//添加环境变量可能要输入密码tcuser


显示如下:

**

docker@localhost’s password:

docker@localhost’s password:

docker@localhost’s password:

Writing /var/root/.boot2docker/certs/boot2docker-vm/ca.pem

Writing /var/root/.boot2docker/certs/boot2docker-vm/cert.pem

Writing /var/root/.boot2docker/certs/boot2docker-vm/key.pem

**

boot2docker ssh


出现以下画面:

**



**

docker daemon


显示如下:

**

Command “daemon” is deprecated, and will be removed in Docker 17.12. Please run
dockerd
directly.

chmod /var/lib/docker: operation not permitted

docker@boot2docker:~$ docker run hello-world

Unable to find image ‘hello-world:latest’ locally

**

docker run hello-world//运行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/

**
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  mac docker