在Windows上如何安装Docker的代码实例分享
下载Docker for 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 访问http://localhost/以显示nginx起始页。
使用 docker ps 命令查看容器列表
使用 docker images 命令查看镜像列表
加速器
在系统右下角托盘图标内右键菜单选择 Settings,打开配置窗口后左侧导航菜单选择 Docker Daemon。编辑窗口内的JSON串,填写如阿里云、DaoCloud之类的加速器地址,如:
{ "registry-mirrors": [ "https://sr5arhkn.mirror.aliyuncs.com", "http://14d216f4.m.daocloud.io" ], "insecure-registries": [] }
以上是在Windows上如何安装Docker的代码实例分享的详细内容。更多信息请关注PHP中文网其他相关文章!

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

AI Hentai Generator
免费生成ai无尽的。

热门文章

热工具

记事本++7.3.1
好用且免费的代码编辑器

SublimeText3汉化版
中文版,非常好用

禅工作室 13.0.1
功能强大的PHP集成开发环境

Dreamweaver CS6
视觉化网页开发工具

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)

热门话题

在Docker环境中使用PECL安装扩展时报错的原因及解决方法在使用Docker环境时,我们常常会遇到一些令人头疼的问�...

为什么我的代码无法获取API返回的数据?在编程中,我们常常会遇到API调用时返回空值的问题,这不仅让人困惑...

掌握Debian系统日志监控是高效运维的关键,它能帮助您及时了解系统运行状况,快速定位故障,并优化系统性能。本文将介绍几种常用的监控方法和工具。利用sysstat工具包监控系统资源sysstat工具包提供了一系列强大的命令行工具,用于收集、分析和报告各种系统资源指标,包括CPU负载、内存使用、磁盘I/O、网络吞吐量等。主要工具包括:sar:全面的系统资源统计工具,涵盖CPU、内存、磁盘、网络等。iostat:磁盘和CPU统计信息。mpstat:多核CPU的统计信息。pidsta

语言多线程可以大大提升程序效率,C 语言中多线程的实现方式主要有四种:创建独立进程:创建多个独立运行的进程,每个进程拥有自己的内存空间。伪多线程:在一个进程中创建多个执行流,这些执行流共享同一内存空间,并交替执行。多线程库:使用pthreads等多线程库创建和管理线程,提供了丰富的线程操作函数。协程:一种轻量级的多线程实现,将任务划分成小的子任务,轮流执行。

高效读取Windows系统日志:反向遍历Evtx文件在使用Python处理Windows系统日志文件(.evtx)时,直接读取会从最早的�...

Python二进制库(.whl)下载途径探究许多Python开发者在Windows系统上安装某些库时会遇到难题。一个常用的解决方法�...

Python跨平台桌面应用开发库的选择许多Python开发者都希望开发出能够在Windows和Linux系统上都能运行的桌面应用程...

使用requests库抓取网页数据时遇到的问题及解决方案在使用Python的requests库获取网页数据时,有时会遇到获取到�...
