当前位置: 首页 > news >正文

Docker Desktop安装

0 Preface/Foreward

0.1 参考文档

Overview of Docker Desktop | Docker Docs (Docker Desktop使用手册)

0.1.1 Docker Dashboard

Before going any further, we want to highlight the Docker Dashboard, which gives you a quick view of the containers running on your machine. It prvovides you access to container logs, lets you get a shell inside the container, and allows you to easily manage container lifecycle (stop, remove, etc.).

0.1.2 What is a container?

Simply put, a container is another process on your machine that has been isolated from all other processes on the host machine. That isolation leverages kernel namespaces and cgroups, features that have been in Linux for a long time. Docker has worked to make these capabilities approachable and easy to use.

0.1.3 What is a container image?

When running a container, it uses an isolated filesystem. This custom filesystem is provided by a container image. Since the image contains the container's filesystem, it must include everyting needed to run the application - all dependencies, configuration, scripts, binaries, etc. The image also contains other configuration for the container, such environment variables, a default command to run, and other metadata.

0.2 Docker Desktop介绍

 0.2.1 Overview

Docker Desktop is one-click-install application for your Mac, Linux, or Windows environment that lets you build, share, and run containerized applications and microservices.

It provides a straightforward GUI (Graphical User Interface) that lets you manage your containers, applications, and images directly from your machine.

Docker Desktop reduces the time spent on complex setups so you can focus on writing code. It takes care of port mappings, file system concerns, and other default settings, and is regularly updated with bug fixed and security updated. 

What's included in Docker Desktop?

  • Docker Engine
  • Docker CLI clent
  • Docker build

0.2.2 Docker Engine

 Docker Engine is an open source containerization technology for building and containerizing your applications. Docker Engine acts as a client-server application with:

  • A server with a long-running daemon process dockerd
  • APIs which specify interfaces that programs can use to talk to and instrcut the Docker daemon.
  • A command line interface (CLI) client docker

0.2.3 Docker Build

Docker build is one of Docker Engine's most used features. Whenever you are creating an image you are using Docker Build. Build is a key part of your software development life cycle allowing you to package and bundle your code and ship it anywhere.

Docker build is more than a command for buiding images, and it's not only about packaging your code. It's a whole ecosystem of tools and features that support not only common workflow tasks but also provides support for more complex and advanced scenarios.

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.

 

命令分析

 docker run -d -p 80:80 docker/getting-started

You will notice that a few flags being used, here is some more info on them:

  • -d - run the container in detached mode (in the background/backend)
  • -p 80:80 - map port 80 of the host to port 80 in the container
  • docker/getting-started - the image to run

Pro tip: Professional tip (专业提示)

You can combine single character flags to shorten the full command. As an example, the command above could be written as:

docker run -dp 80:80 docker/getting-started

 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)。

相关文章:

  • 北京网站建设多少钱?
  • 辽宁网页制作哪家好_网站建设
  • 高端品牌网站建设_汉中网站制作
  • 汽车免拆诊断案例 | 2014 款上汽名爵 GT 车发动机无法起动
  • PACS-医学影像信息管理系统,全影像科室PACS源码,内置包括MPR、CMPR、VR等三维处理功能
  • vue2获取视频时长
  • Docker-Compose实现MySQL之主从复制
  • 理想化相机模型的相机内参
  • 医学图像分类
  • 金融数据的pandas模块应用
  • iview中Checkbox组件设置不勾选是0,勾选是1
  • Mac安装Hoomebrew与升级Python版本
  • 高可用高并发常见问题以及答案
  • easyExcel
  • Java | Leetcode Java题解之第260题只出现一次的数字III
  • ELK日志收集之多文件提取文件名和日志时间
  • vue侦听器(Watch)精彩案例剖析二
  • 如何实现Web服务只允许特定客户端访问
  • [rust! #004] [译] Rust 的内置 Traits, 使用场景, 方式, 和原因
  • 11111111
  • extract-text-webpack-plugin用法
  • IE报vuex requires a Promise polyfill in this browser问题解决
  • Java精华积累:初学者都应该搞懂的问题
  • Mocha测试初探
  • MySQL数据库运维之数据恢复
  • Quartz实现数据同步 | 从0开始构建SpringCloud微服务(3)
  • Sequelize 中文文档 v4 - Getting started - 入门
  • TiDB 源码阅读系列文章(十)Chunk 和执行框架简介
  • vue2.0一起在懵逼的海洋里越陷越深(四)
  • Vultr 教程目录
  • webpack4 一点通
  • 从 Android Sample ApiDemos 中学习 android.animation API 的用法
  • 从@property说起(二)当我们写下@property (nonatomic, weak) id obj时,我们究竟写了什么...
  • 第13期 DApp 榜单 :来,吃我这波安利
  • 微信开源mars源码分析1—上层samples分析
  • 一个普通的 5 年iOS开发者的自我总结,以及5年开发经历和感想!
  • 以太坊客户端Geth命令参数详解
  • - 转 Ext2.0 form使用实例
  • 做一名精致的JavaScripter 01:JavaScript简介
  • 长三角G60科创走廊智能驾驶产业联盟揭牌成立,近80家企业助力智能驾驶行业发展 ...
  • ​ssh-keyscan命令--Linux命令应用大词典729个命令解读
  • # 执行时间 统计mysql_一文说尽 MySQL 优化原理
  • #1015 : KMP算法
  • #我与Java虚拟机的故事#连载05:Java虚拟机的修炼之道
  • (01)ORB-SLAM2源码无死角解析-(66) BA优化(g2o)→闭环线程:Optimizer::GlobalBundleAdjustemnt→全局优化
  • (1/2) 为了理解 UWP 的启动流程,我从零开始创建了一个 UWP 程序
  • (27)4.8 习题课
  • (备份) esp32 GPIO
  • (第一天)包装对象、作用域、创建对象
  • (二十一)devops持续集成开发——使用jenkins的Docker Pipeline插件完成docker项目的pipeline流水线发布
  • (考研湖科大教书匠计算机网络)第一章概述-第五节1:计算机网络体系结构之分层思想和举例
  • (六)软件测试分工
  • (篇九)MySQL常用内置函数
  • (算法)Game
  • (一一四)第九章编程练习
  • (转) Face-Resources
  • (转)C语言家族扩展收藏 (转)C语言家族扩展
  • .gitignore文件设置了忽略但不生效