Docker for Windows

安装包:点击此处

Docker for Windows

Get started with Docker for Windows

环境设值:

  • Shared Drivers:可以将主机(也就是Windows机器)中的驱动器共享到Docker Container中
  • Advanced:用于配置运行Docker Daemon的虚拟环境的CPU和内存
  • Network:配置Docker的网络环境
  • Proxies:代理的配置
  • Docker Daemon:使用JSON格式的设置,对Docker Daemon进行配置,类似于在Linux环境中使用conf文件对Docker进行配置

Docker for Windows的安装过程会在Hyper-V中创建一台用于运行Docker Daemon的Linux虚拟机,这个对话框中的很多配置也就是针对该虚拟机所作出的配置。当配置发生更改后,Docker for Windows会重新启动(小鲸鱼背上的小方块又会动起来),这个过程其实就是这台Linux虚拟机的配置进行动态调整和重启的过程。

 

 

 服务重启:

 

在Docker for Windows成功启动后,就可以在Windows命令提示符下执行Docker命令了,也可以在Power Shell中执行Docker命令,看个人喜好吧。Docker CLI的体验和Linux下是一样的

使用Docker for Windows在容器中运行ASP.NET Core Web API应用程序

1.首先确保Dockerfile文件与发布出来的DockerWebAPI应用程序的文件都在同一个目录下:

2.启动power shell,在程序目录下 执行docker build . -t tagName

  与Linux下编译Docker Image相比,这里多了一个安全警告。这是因为我们是在Windows下使用部署在非Windows中的Docker服务来完成的Image的编译生成,两套系统中的文件权限设置不同。Docker for Windows建议在编译生成的Image上对文件的权限进行检查以确保安全。

3.docker run 命令

  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.

  Type exit to stop the container and close the powershell.

4.浏览器输入url ,测试webapi接口

配置

Shared Drives

Share your local drives (volumes) with Docker for Windows, so that they are available to your containers.

You will be asked to provide your Windows system username and password (domain user) to apply shared drives. You can select an option to have Docker store the credentials so that you don’t have to re-enter them every time.

原文地址:https://www.cnblogs.com/panpanwelcome/p/8352795.html