Windows安装docker及遇到的问题

docker下载及教程

Operating System: Windows 10 企业版 64-bit (10.0, Build 18362) (18362.19h1_release.190318-1202)
                 Language: Chinese (Simplified) (Regional Setting: Chinese (Simplified))
      System Manufacturer: LENOVO
             System Model: 30BGA3EXCW
                     BIOS: LENOVO BIOS Rev:S06KT24A 0.0 (type: BIOS)
                Processor: Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz (8 CPUs), ~3.4GHz
                   Memory: 32768MB RAM
      Available OS Memory: 32696MB RAM
                Page File: 16836MB used, 20723MB available
              Windows Dir: C:\WINDOWS
          DirectX Version: DirectX 12
      DX Setup Parameters: Not found
         User DPI Setting: 96 DPI (100 percent)
       System DPI Setting: 96 DPI (100 percent)
          DWM DPI Scaling: Disabled
                 Miracast: Available, no HDCP
Microsoft Graphics Hybrid: Not Supported
 DirectX Database Version: Unknown
           DxDiag Version: 10.00.18362.0387 64bit Unicode
  • window安装docker 先决条件:
    1、Windows 10 操作系统为专业版、企业版、教育版及部分家庭版!
    2、开启server:CMD命令运行:services.msc,找的Server并启动。
    3、安装及开启Hyper-V:控制面板--程序--启用或关闭Windows功能--勾选Hyper-V
    Hyper-V 是微软开发的虚拟机,类似于 VMWare 或 VirtualBox,仅适用于 Windows 10。这是 Docker Desktop for Windows 所使用的虚拟机。但是,这个虚拟机一旦启用,QEMU、VirtualBox 或 VMWare Workstation 15 及以下版本将无法使用!如果你必须在电脑上使用其他虚拟机(例如开发 Android 应用必须使用的模拟器),请不要使用 Hyper-V!
    4、将我们的CPU虚拟化设置为启动状态


    image.png

    如果不是启用状态,启动电脑进入BIOS,(电脑开机后一直按F1,不同电脑不一样)


    image.png

安装遇到的问题及解决办法

1、安装最新版本的docker(4.4.3.0)后,打开Docker Desktop提示:A JavaScript error occurred in the main process,百度搜了一些解决方案,最后还是未解决,所以后来就安装了低版本的docker。

image.png

参考解决方案:
https://github.com/docker/for-win/issues/12374
https://www.ircache.net/solved-a-javascript-error-occurred-in-the-main-process/#:~:text=This%20is%20one%20of%20the%20main%20reasons%20for,check%20if%20Windows%20Audio%20Video%20Experience%20is%20active.

2、安装低版本的docker(3.0.4.51218)
在历史版本里面找到该版本并下载:https://docs.docker.com/desktop/windows/release-notes/3.x/
安装后Docker Desktop可以正常打开,但用命令行进行测试时报错:

PS C:\Users> docker run -d -p 80:80 docker/getting-started
docker: error during connect: In the default daemon configuration on Windows, the docker client must be run with elevated privileges to connect.: Post http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/containers/create: open //./pipe/docker_engine: The system cannot find the file specified.

解决办法:
在cmd命令运行下面的脚本:

cd "C:\Program Files\Docker\Docker"
DockerCli.exe -SwitchDaemon

再次运行就可以正常运行了:

PS C:\Users> docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
3a78847ea829: Pull complete                                                                                                                                                                                                                                                    052260bdedd9: Pull complete                                                                                                                                                                                                                                                    47a64f8bebcb: Pull complete                                                                                                                                                                                                                                                    Digest: sha256:975f4b14f326b05db86e16de00144f9c12257553bba9484fed41f9b6f2257800
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.
    (windows-amd64, nanoserver-1809)
 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 a Windows Server container with:
 PS C:\> docker run -it mcr.microsoft.com/windows/servercore:ltsc2019 powershell

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

参考解决方案
https://stackoverflow.com/questions/67160140/docker-error-during-connect-in-the-default-daemon-configuration-on-windows-th
https://blog.csdn.net/nyasm/article/details/121569182

如果遇到其他问题可以在这里查找一下
https://github.com/docker/for-win

使用遇到的问题:

下载镜像时报错

PS C:\Users> docker pull centos
Using default tag: latest
latest: Pulling from library/centos
no matching manifest for windows/amd64 10.0.18362 in the manifest list entries

解决办法:
Docker Desktop点击Settings--Docker Engine,设置daemon.json的experimental:true


image.png
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容