博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Docker 安装 之 toolbox在Windows下安装Docker)
阅读量:7019 次
发布时间:2019-06-28

本文共 5029 字,大约阅读时间需要 16 分钟。

  hot3.png

安装之前先了解下关键概念:

在linux上安装Docker,你的机器即使localhost也是docker主机;在网络中,localhost是指您的计算机。docker主机是容器中在该机器上运行。说白了就是直接安装在linux上,英文翻译真蛋疼。

在Windows安装,Docker守护进程运行Linux虚拟机内。您可以使用Windows的客户端与虚拟机中的Docker主机通信。这台主机中运行你的Docker容器。

 

在Windows中,Docker主机地址是Linux VM的地址。当启动docker-machine虚拟机时会被分配一个IP地址。当你启动一个容器,容器的端口会映射到VM。

安装

 

https://www.docker.com/toolbox

或者去github上下在:https://github.com/boot2docker/windows-installer/releases

不能下载 可以到网盘下载 链接: http://pan.baidu.com/s/1jGrkJ7w 密码: 3xie

基本是下一步,下一步,最后一步选上 加到path:

the Docker Quickstart Terminal

装完后桌面上会多出几个图标,其中有一个是Docker Quickstart Terminal,双击运行,居然出现错误:

关掉,已管理员身份运行:

## .
## ## ## ==
## ## ## ## ## ===
/"""""""""""""""""\___/ ===
~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ / ===- ~~~
\______ o __/
\ \ __/
\____\_______/

host is not running

docker is configured to use the default machine with IP
For help getting started, check out the docs at https://docs.docker.com
lei@ganlei MINGW64 ~
$

手动启动虚拟机,提示VT-x/AMD-V 硬件加速在系统中不可用;记得以前用VMware时开启过的,重启进BIOS检查,发现状态是Disabled,修改为Enabled 开启虚拟化支持:

删掉重新来:

Creating Machine default…

Creating VirtualBox VM…
Creating SSH key…
Starting VirtualBox VM…
Starting VM…
To see how to connect Docker to this machine, run: G:\Program Files\Docker Toolbox\docker-machine.exe env default
Starting machine default…
Started machines may have new IP addresses. You may need to re-run the `docker-machine env` command.
Setting environment variables for machine default…
## .
## ## ## ==
## ## ## ## ## ===
/”””””””””””””””””\___/ ===
~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ / ===- ~~~
\______ o __/
\ \ __/
\____\_______/

docker is configured to use the default machine with IP 192.168.99.100

For help getting started, check out the docs at https://docs.docker.com
lei@ganlei MINGW64 ~
$

瞅一眼Docker主机是什么样子的:

通过运行hello-world容器来验证是否安装成功:

lei@ganlei MINGW64 ~

$ docker run hello-world
Unable to find image ‘hello-world:latest’ locally
latest: Pulling from library/hello-world
535020c3e8ad: Pulling fs layer
af340544ed62: Pulling fs layer
af340544ed62: Verifying Checksum
af340544ed62: Download complete
535020c3e8ad: Verifying Checksum
535020c3e8ad: Download complete
535020c3e8ad: Pull complete
af340544ed62: Pull complete
library/hello-world:latest: The image you are pulling has been verified. Important: image verification is a tech preview feature and should not be relied on to provide security.
Digest: sha256:02fee8c3220ba806531f606525eceb83f4feb654f62b207191b1c9209188dedd
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 Hub account:

https://hub.docker.com

For more examples and ideas, visit:

https://docs.docker.com/userguide/
lei@ganlei MINGW64 ~
$

安装Docker镜像:

默认用户名docker,密码:tcuser

$ ssh docker@192.168.99.100

docker@192.168.99.100’s password:
## .
## ## ## ==
## ## ## ## ## ===
/”””””””””””””””””\___/ ===
~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ / ===- ~~~
\______ o __/
\ \ __/
\____\_______/
_ _ ____ _ _
| |__ ___ ___ | |_|___ \ __| | ___ ___| | _____ _ __
| ‘_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ ‘__|
| |_) | (_) | (_) | |_ / __/ (_| | (_) | (__| < __/ |
|_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_|
Boot2Docker version 1.8.2, build master : aba6192 – Thu Sep 10 20:58:17 UTC 2015
Docker version 1.8.2, build 0a8c2e3
docker@default:~$

拉取一个镜像:

docker pull daocloud.io/daocloud/dao-2048:v1.0
Pulling repository daocloud.io/daocloud/dao-2048
ebedc5b763b3: Pulling image (v1.0) from daocloud.io/daocloud/dao-2048, endpoint:ebedc5b763b3: Download complete
31f630c65071: Download complete
1eae7e4d52e1: Download complete
63e8c6f236f9: Download complete
2a6e8fa08c63: Download complete
c96993b7308a: Download complete
Status: Downloaded newer image for daocloud.io/daocloud/dao-2048:v1.0
查看镜像:
docker@default:~$ docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
hello-world latest af340544ed62 6 weeks ago 960 B
daocloud.io/daocloud/dao-2048 v1.0 ebedc5b763b3 9 weeks ago 8.017 MB
daocloud.io/library/ubuntu 10.04 3db9c44f4520 17 months ago 183 MB
docker@default:~$

运行容器:

docker@default:~$ docker run -i -t daocloud.io/library/ubuntu:10.04 /bin/bash
root@6c76a556b6ed:/# ls
bin boot dev etc home lib lib64 media mnt opt proc root sbin selinux srv sys tmp usr var
root@6c76a556b6ed:/# pwd
/

 

如果有阿里云的ECS可以利用云服务器内网来拉取镜像,阿里云ECS内网Docker镜像地址:http://help.aliyun.com/knowledge_detail.htm?knowledgeId=5974865

docker官方安装文档:https://docs.docker.com/installation/windows/

转载于:https://my.oschina.net/jlu100/blog/617749

你可能感兴趣的文章
AI 科技评论和学术青年们的 GAIR 小聚会,面基就要freestyle|CCF-GAIR 2017
查看>>
国内首个14纳米硅片凸块量产 高通高端芯片“中国造”
查看>>
“Watson之眼”走出实验室,中国医疗机器人悄然崛起 | 未来医疗周刊
查看>>
依托大数据,医改要有基于标准体系的资源配置
查看>>
抢夺英特尔Mac订单 AMD拦路虎暂不成气候
查看>>
没落的雅达利要分智能家居市场一杯羹 有点晚
查看>>
晋能科技高效多晶组件助力吕梁多个扶贫项目顺利并网
查看>>
AI运算存储器需求仍靠外供 大数据或孕育新市场
查看>>
五大气象引领物联网发展新高潮,但政府角色需调整
查看>>
数据中心选址需要明智的决策
查看>>
Windows 10“创作者更新”改进了高DPI缩放支持
查看>>
选择公共云供应商的标准
查看>>
中兴微电子2016年蝉联IC设计企业前三,芯片发货量大幅增长
查看>>
安防工程投标技巧
查看>>
Manifest.xml 入门基础 (四) &lt;application&gt;标签
查看>>
Lucene5学习之Spatial地理位置搜索
查看>>
Android获取手机应用
查看>>
浮动元素容器的clearing问题
查看>>
KVM快照的创建与恢复
查看>>
转 OC之iOS开发常用Unix指令
查看>>