Windows运维之在Windows上安装Docker
小标 2018-07-31 来源 : 阅读 1360 评论 0

摘要:本文主要向大家介绍了Windows运维之在Windows上安装Docker,通过具体的内容向大家展现,希望对大家学习Windows运维有所帮助。

本文主要向大家介绍了Windows运维之在Windows上安装Docker,通过具体的内容向大家展现,希望对大家学习Windows运维有所帮助。

稳定版

准备安装Docker for Windows
安装前请保障 Windows10 版本大于或等于 1703,os版本大于或等于 15063
我在版本1607下安装就会有找不到引用汇编文件的错误
必须启用Hyper-V软件包才能使Docker for Windows工作。如果您的系统不满足这些要求,您可以安装Docker Toolbox,它使用Oracle Virtual Box而不是Hyper-V。
在 Windows 10 上安装 Hyper-V 网址

安装Docker for Windows
双击InstallDocker.msi以运行安装程序。

检查Docker
打开PowerShell,输入以下代码

PS C:\Users\Docker> docker --version

Docker version 17.03.0-ce, build 60ccb22

 

PS C:\Users\Docker> docker-compose --version

docker-compose version 1.11.2, build dfed245

 

PS C:\Users\Docker> docker-machine --version

docker-machine version 0.10.0, build 76ed2a6

运行docker run hello-world来测试从Docker Hub拉一个镜像并启动一个容器。

PS C:\Users\jdoe> docker run hello-world

Hello from Docker. This message shows that your installation appears
to be working correctly.

To generate this message, Docker took the following steps:

 

The Docker client contacted the Docker daemon.

The Docker daemon pulled the "hello-world" image from the Docker Hub.

The Docker daemon created a new container from that image which runs the executable that produces the output you are currently
reading.

The Docker daemon streamed that output to the Docker client, which sent it to your terminal.

尝试更有野心的东西,并使用此命令运行Ubuntu容器。
这将下载ubuntu容器镜像并启动它。以下是在powerhell中运行此命令的输出。

PS C:Usersjdoe> docker run -it ubuntu bash

Unable to find image 'ubuntu:latest' locally latest: Pulling from
library/ubuntu 5a132a7e7af1: Pull complete fd2731e4c50c: Pull complete
28a2f68d1120: Pull complete a3ed95caeb02: Pull complete Digest:
sha256:4e85ebe01d056b43955250bbac22bdb8734271122e3c78d21e55ee235fc6802d
Status: Downloaded newer image for ubuntu:latest

使用docker开启nginx服务器

PS C:\Users\jdoe> docker run -d -p 80:80 --name webserver nginx

Unable to find image 'nginx:latest' locally latest: Pulling from
library/nginx

fdd5d7827f33: Pull complete a3ed95caeb02: Pull complete 716f7a5f3082:
Pull complete 7b10f03a0309: Pull complete Digest:
sha256:f6a001272d5d324c4c9f3f183e1b69e9e0ff12debeb7a092730d638c33e0de3e
Status: Downloaded newer image for nginx:latest
dfe13c68b3b86f01951af617df02be4897184cbf7a8b4d5caf1c3c5bd3fc267f

访问//localhost/以显示nginx起始页。

使用 docker ps 命令查看容器列表
使用 docker images 命令查看镜像列表

加速器

在系统右下角托盘图标内右键菜单选择 Settings,打开配置窗口后左侧导航菜单选择 Docker Daemon。编辑窗口内的JSON串,填写如阿里云、DaoCloud之类的加速器地址,如:

    {

     "registry-mirrors": [

       "https://sr5arhkn.mirror.aliyuncs.com",

       "//14d216f4.m.daocloud.io"

     ],

     "insecure-registries": []

   }

 

本文由职坐标整理并发布,希望对同学们有所帮助。了解更多详情请关注系统运维windows频道!

本文由 @小标 发布于职坐标。未经许可,禁止转载。
喜欢 | 0 不喜欢 | 0
看完这篇文章有何感觉?已经有0人表态,0%的人喜欢 快给朋友分享吧~
评论(0)
后参与评论

您输入的评论内容中包含违禁敏感词

我知道了

助您圆梦职场 匹配合适岗位
验证码手机号,获得海同独家IT培训资料
选择就业方向:
人工智能物联网
大数据开发/分析
人工智能Python
Java全栈开发
WEB前端+H5

请输入正确的手机号码

请输入正确的验证码

获取验证码

您今天的短信下发次数太多了,明天再试试吧!

提交

我们会在第一时间安排职业规划师联系您!

您也可以联系我们的职业规划师咨询:

小职老师的微信号:z_zhizuobiao
小职老师的微信号:z_zhizuobiao

版权所有 职坐标-一站式AI+学习就业服务平台 沪ICP备13042190号-4
上海海同信息科技有限公司 Copyright ©2015 www.zhizuobiao.com,All Rights Reserved.
 沪公网安备 31011502005948号    

©2015 www.zhizuobiao.com All Rights Reserved