欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 文旅 > 美景 > Docker Desktop安装

Docker Desktop安装

2024/10/24 3:21:13 来源:https://blog.csdn.net/yanlaifan/article/details/140616111  浏览:    关键词:Docker Desktop安装

0 Preface/Foreward

1 安装

1.1 运行docker安装包

安装完Docker Desktop后,运行Docker Desktop,出现WSL 2安装不完整情况,具体情况如下: 

解决方法:旧版 WSL 的手动安装步骤 | Microsoft Learn

也可以直接下载新的安装包,然后安装。https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi

1.2 开始使用Docker

 1.2.1 Clone a repository

 The Getting Started project is a simple GitHub repository which contains everyting you need to build an image and run it as a container.

Clone the repository by running Git in a container. 

You can also type the command directly in a command line interface/application.

 1.2.2 Build the image

 

A Docker image is a private file system just for your container. It provides all the files and code your container needs.

 

 

 1.2.3 Run your first container

 

Start a container based on the image you built in the previous step. Running a container launches your application with private resources, securely isolated from the rest of your machine.

 

 1.2.4 Share

 You must be signed in to Docker Hub to share your image.

Save and share your image on Docker Hub to enable other users to easily download and run the image on any destiantion machine.

 

2 使用

2.1 启动Docker

注意:要启动Docker,需要登陆账号。

 PS C:\Users\Andy.fan> docker run -d -p 80:80 docker/getting-started
Unable to find image 'docker/getting-started:latest' locally
latest: Pulling from docker/getting-started
c158987b0551: Pull complete
1e35f6679fab: Pull complete
cb9626c74200: Pull complete
b6334b6ace34: Pull complete
f1d1c9928c82: Pull complete
9b6f639ec6ea: Pull complete
ee68d3549ec8: Pull complete
33e0cbbb4673: Pull complete
4f7e34c2de10: Pull complete
Digest: sha256:d79336f4812b6547a53e735480dde67f8f8f7071b414fbd9297609ffb989abc1
Status: Downloaded newer image for docker/getting-started:latest
0130d63f7f0180c19450c9c03278bd1e56f19b6f86b6779ccf80bdd74f906341
PS C:\Users\Andy.fan>

 2.2 为WSL distro激活Docker desktop

 

 参考上面的建议文档:https://docs.docker.com/desktop/wsl/

 根据上面提醒,在Docker Desktop设置界面:settings > Resources > WSL INTEGRATION

选中默认的WSL distro(可以按照多个发行版本),当前只安装了一个发行版本,所以Ubuntu-18.04就是默认的发行版本。

激活成功WSL Docker Desktop,输入docker命令,显示Usage 命令文本:

2.3 Docker Desktop启动的WSL distro

 Docker Desktop 安装了两个special-purpose internal Linux distros:都不能用作通用开发

  • docker-desktop:用来运行Docker engine (dockerd)
  • docker-desktop-data:存储容器(containers)和镜像(image)。

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com