在windows下安装docker-desktop

Docker Desktop是一个在Windows和macOS上运行的应用程序,能够让开发者使用Docker容器技术。它包括了Docker Engine、Docker CLI客户端、Docker Compose、Docker Content Trust、Kubernetes和Credential Helper等。下面是一篇详细的指南,帮助你在Windows上安装Docker Desktop。这是个好东西,作为开发者,电脑上可能需要允许各种软件用来做不同需求的程序,Docker desktop的出现,将对机器资源利用的极致压榨从linux带到了windows,对程序员的日常工作有很大的帮助。

系统要求

在安装Docker Desktop之前,请确保你的系统满足以下要求:

  1. 操作系统:Windows 10 64位:Pro、Enterprise 或 Education(Build 15063或更高版本),或Windows 11。
  2. 硬件支持:支持的处理器和硬件虚拟化。
  3. 内存:至少4GB RAM。

安装步骤

1. 下载Docker Desktop
  1. 打开Docker官方网站docker desktop产品主页
  2. 点击“Download for Windows”按钮,下载Docker Desktop安装程序。
2. 安装、配置Docker Desktop
  1. 双击运行Docker Desktop Installer.exe
  2. 开启Hyper-V服务

        控制面板—程序—程序和功能—启动或关闭Windows功能 中 勾选【Hyper-V】和【容器】选项

        

        重启电脑。

3. 启动Docker Desktop
  1. 重启后,启动Docker Desktop会自动启动,Docker Desktop可能会要求你登录Docker账号。如果你没有账号,可以点击“Sign up”进行注册,然后登录。顺便说下,登录会跳到https://hub.docker.com/,而此地址需要科学上网才能正常访问。
4. 验证安装
  1. 启动Docker Desktop后,你会看到Docker的鲸鱼图标出现在系统托盘中。当鼠标悬浮在鲸鱼图标变成绿色时,表示Docker已经成功启动并运行。

  2. 打开命令提示符或PowerShell,输入以下命令来验证Docker安装是否成功:

    >docker --version

    你应该会看到Docker的版本信息,类似于:

    >Docker version 25.0.3, build 4debf41
  3. 按照程序界惯例,每安装新软件,都要来一次hello word:

    >docker run hello-world
    
    Unable to find image 'hello-world:latest' locally
    latest: Pulling from library/hello-world
    c1ec31eb5944: Pull complete
    Digest: sha256:266b191e926f65542fa8daaec01a192c4d292bff79426f47300a046e1bc576fd
    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.
        (amd64)
     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 an Ubuntu container with:
     $ docker run -it ubuntu bash
    
    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/

配置WSL 2后端(可选)

Docker Desktop默认使用WSL 2(Windows Subsystem for Linux 2)作为后端。如果你的系统支持并且你希望使用WSL 2,可以按照以下步骤进行配置:

  1. 启用Windows的Linux子系统:


欢迎关注我们人工智能在新媒体领域应用的公众号。

  • 11
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值