excel表格如何拉长
3174
2022-05-29
在windows上使用Docker大概有三种方式:
Docker desktop for windows
Microsoft store app来安装linux子系统
Hyper-V创建虚拟机来安装docker
以上三种方式,比较推荐使用Hyper-V的虚拟机来安装docker,使用Hyper-V来安装linux虚拟机在操作系统和设置上的坑比较少,以下使用windows 10的Hyper-V虚拟机来安装docker。
首先需要启用windows的Hyper-V管理器:
在打开Hyper-V管理器创建VM前需要启用Hyper-V相关计算服务,如:
有时启动服务或在Hyper-V管理虚拟机时会报异常,可以确认如下配置:
Windows安全中心中的:
完成如上正常打开:
可通过原生centos或其他linux iso更改安装源完成操作系统的安装:
完成linux系统的安装后可通过共享网卡的方式实现虚拟机上网,在网卡设置中设置internet共享:
通过yum完成docker的安装,docker从公网拉取镜像,可以通过设置docker的proxy:
可参考https://docs.docker.com/config/daemon/systemd/,如下:
Create a systemd drop-in directory for the docker service:
$ sudo mkdir -p /etc/systemd/system/docker.service.d
2.Create a file called /etc/systemd/system/docker.service.d/http-proxy.conf that adds the HTTP_PROXY environment variable:
[Service]Environment="HTTP_PROXY=http://proxy.example.com:80/"
Or, if you are behind an HTTPS proxy server, create a file called /etc/systemd/system/docker.service.d/https-proxy.conf that adds the HTTPS_PROXY environment variable:
[Service]Environment="HTTPS_PROXY=https://proxy.example.com:443/"
3.If you have internal Docker registries that you need to contact without proxying you can specify them via the NO_PROXY environment variable.
The NO_PROXY variable specifies a string that contains comma-separated values for hosts that should be excluded from proxying. These are the options you can specify to exclude hosts:
Config examples:
[Service] Environment="HTTP_PROXY=http://proxy.example.com:80/" "NO_PROXY=localhost,127.0.0.1,docker-registry.example.com,.corp"
Or, if you are behind an HTTPS proxy server:
[Service] Environment="HTTPS_PROXY=https://proxy.example.com:443/" "NO_PROXY=localhost,127.0.0.1,docker-registry.example.com,.corp"
example.com matches example.com and foo.example.com, and
.example.com matches only foo.example.com
IP address prefix (1.2.3.4)
Domain name, or a special DNS label (*)
A domain name matches that name and all subdomains. A domain name with a leading “.” matches subdomains only. For example, given the domains foo.example.com and example.com:
A single asterisk (*) indicates that no proxying should be done
Literal port numbers are accepted by IP address prefixes (1.2.3.4:80) and domain names (foo.example.com:80)
Flush changes:
$ sudo systemctl daemon-reload
Restart Docker:
$ sudo systemctl restart docker
Verify that the configuration has been loaded:
$ systemctl show --property=Environment dockerEnvironment=HTTP_PROXY=http://proxy.example.com:80/
Or, if you are behind an HTTPS proxy server:
$ systemctl show --property=Environment dockerEnvironment=HTTPS_PROXY=https://proxy.example.com:443/
完成如上正常能从公网拉取镜像等:
在使用代理时,如果需要创建容器网络,需要避免使用的网段与proxy的网络产生冲突,会导致代理失效。
后续的虚拟机管理可以通过Hyper-V管理器来进行管理:
Windows Docker
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。