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

基于Windows11的DockerDesktop安装和布署方法简介

基于Windows11的DockerDesktop安装和布署方法简介
一、下载安装Docker
docker 下载地址
https://www.docker.com/

Download Docker Desktop
选择Download for Winodws AMD64下载Docker Desktop Installer.exe
双点击 Docker Desktop Installer.exe 进行安装

测试Docker安装是否成功:命令行中输入docker
显示如下所示:表示安装成功

C:\Users\Administrator>docker

Usage:  docker [OPTIONS] COMMAND

A self-sufficient runtime for containers

Common Commands:
  run         Create and run a new container from an image
  exec        Execute a command in a running container
  ps          List containers
  build       Build an image from a Dockerfile
  pull        Download an image from a registry
  push        Upload an image to a registry
  images      List images
  login       Authenticate to a registry
  logout      Log out from a registry
  search      Search Docker Hub for images
  version     Show the Docker version information
  info        Display system-wide information

Management Commands:
  ai*         Ask Gordon - Docker Agent
  builder     Manage builds
  buildx*     Docker Buildx
  compose*    Docker Compose
  container   Manage containers
  context     Manage contexts
  debug*      Get a shell into any image or container
  desktop*    Docker Desktop commands (Beta)
  dev*        Docker Dev Environments
  extension*  Manages Docker extensions
  feedback*   Provide feedback, right in your terminal!
  image       Manage images
  init*       Creates Docker-related starter files for your project
  manifest    Manage Docker image manifests and manifest lists
  network     Manage networks
  plugin      Manage plugins
  sbom*       View the packaged-based Software Bill Of Materials (SBOM) for an image
  scout*      Docker Scout
  system      Manage Docker
  trust       Manage trust on Docker images
  volume      Manage volumes

Swarm Commands:
  swarm       Manage Swarm

Commands:
  attach      Attach local standard input, output, and error streams to a running container
  commit      Create a new image from a container's changes
  cp          Copy files/folders between a container and the local filesystem
  create      Create a new container
  diff        Inspect changes to files or directories on a container's filesystem
  events      Get real time events from the server
  export      Export a container's filesystem as a tar archive
  history     Show the history of an image
  import      Import the contents from a tarball to create a filesystem image
  inspect     Return low-level information on Docker objects
  kill        Kill one or more running containers
  load        Load an image from a tar archive or STDIN
  logs        Fetch the logs of a container
  pause       Pause all processes within one or more containers
  port        List port mappings or a specific mapping for the container
  rename      Rename a container
  restart     Restart one or more containers
  rm          Remove one or more containers
  rmi         Remove one or more images
  save        Save one or more images to a tar archive (streamed to STDOUT by default)
  start       Start one or more stopped containers
  stats       Display a live stream of container(s) resource usage statistics
  stop        Stop one or more running containers
  tag         Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
  top         Display the running processes of a container
  unpause     Unpause all processes within one or more containers
  update      Update configuration of one or more containers
  wait        Block until one or more containers stop, then print their exit codes

Global Options:
      --config string      Location of client config files (default
                           "C:\\Users\\Administrator\\.docker")
  -c, --context string     Name of the context to use to connect to the
                           daemon (overrides DOCKER_HOST env var and
                           default context set with "docker context use")
  -D, --debug              Enable debug mode
  -H, --host list          Daemon socket to connect to
  -l, --log-level string   Set the logging level ("debug", "info",
                           "warn", "error", "fatal") (default "info")
      --tls                Use TLS; implied by --tlsverify
      --tlscacert string   Trust certs signed only by this CA (default
                           "C:\\Users\\Administrator\\.docker\\ca.pem")
      --tlscert string     Path to TLS certificate file (default
                           "C:\\Users\\Administrator\\.docker\\cert.pem")
      --tlskey string      Path to TLS key file (default
                           "C:\\Users\\Administrator\\.docker\\key.pem")
      --tlsverify          Use TLS and verify the remote
  -v, --version            Print version information and quit

Run 'docker COMMAND --help' for more information on a command.

For more help on how to use Docker, head to https://docs.docker.com/go/guides/

C:\Users\Administrator>

二、配置Docker
打开Docker 应用时 不需要注册,直接跳过。
国外docker镜像 可能无法拉取,需在Docker中做DockerEngine的相关配置:
设置/Docker Engine中添加如下代码:

"experimental": false, 后加上如下Docker镜像地址,建议直接复制
"registry-mirrors": [
	"https://docker.m.daocloud.io/",
	"https://huecker.io/",
	"https://dockerhub.timeweb.cloud",
	"https://noohub.ru/",
	"https://dockerproxy.com",
	"https://docker.mirrors.ustc.edu.cn",
	"https://docker.nju.edu.cn",
	"https://xx4bwyg2.mirror.aliyuncs.com",
	"http://f1361db2.m.daocloud.io",
	"https://registry.docker-cn.com",
	"http://hub-mirror.c.163.com"
]
配置修改后,点击 Apply&restart 保存并重启Docker

全部配置参数如下所示:

{
  "builder": {
    "gc": {
      "defaultKeepStorage": "20GB",
      "enabled": true
    }
  },
  "experimental": false,
  "registry-mirrors": [
	"https://docker.m.daocloud.io/",
	"https://huecker.io/",
	"https://dockerhub.timeweb.cloud",
	"https://noohub.ru/",
	"https://dockerproxy.com",
	"https://docker.mirrors.ustc.edu.cn",
	"https://docker.nju.edu.cn",
	"https://xx4bwyg2.mirror.aliyuncs.com",
	"http://f1361db2.m.daocloud.io",
	"https://registry.docker-cn.com",
	"http://hub-mirror.c.163.com"
  ]

}

三、启动Docker服务
启动前置条件:

BIOS设置
启用Intel Virtualization Techndogx
Intel VMX/AMD SVM等

控制面板设置/启用Window功能
Hyper-V
Virtual Machine Platform
Windows Subsystem for Linux
启用HV主机服务
Windows启动时启用了虚拟机监控程序

去掉HOSTS文件只读属性

重新关闭和启动hyper-v,来解决解决hyper-v导致docker无法启动问题
用管理员身份打开cmd,执行一下命令

1.禁用hyper-v
bcdedit /set hypervisorlaunchtype off

bcdedit /set hypervisorlaunchtype off 

2.重新启用hyper-v
bcdedit /set hypervisorlaunchtype auto

bcdedit /set hypervisorlaunchtype auto

解决WSL错误问题:

wsl --shutdown
wsl
wsl --update
wsl.exe --install --no-distribution

然后重启电脑
点击Apply 和restart功能
restart功能在界面底部Engine runing 后面的三个坚点下拉菜单中点击运行
在这里插入图片描述
本blog地址:https://blog.csdn.net/hsg77


http://www.kler.cn/a/573140.html

相关文章:

  • C# Unity 面向对象补全计划 之 索引器与迭代器
  • Go语言select的高级玩法
  • Vue的简单入门 三
  • OCPP扩展机制与自定义功能开发:协议灵活性设计与实践 - 慧知开源充电桩平台
  • 确定信号分析:从傅里叶级数到信号带宽的Matlab实践
  • Zookeeper 的 Node(Znode) 是什么?Zookeeper 监听机制的特点是什么?
  • Mybatis控制台打印SQL执行信息(执行方法、执行SQL、执行时间)
  • ShareExpert SparseMoE的学习
  • Sass 模块化革命:深入解析 @use 语法,打造高效 CSS 架构
  • 如何在 WebSocketHandler 中控制连接的断开
  • 016.3月夏令营:数理类
  • js 之 lodash函数库 的下载与基础使用
  • 深圳区域、人口、地铁线
  • Amorphous Data如何在DigitalOcean上构建智能、经济的AI Agent
  • Matlab实现车牌识别
  • 【AI神经网络与人脑神经系统的关联及借鉴分析】
  • 数据结构(四)栈和队列
  • python代码注释方式
  • (数据结构)双向链表
  • 自己的网页加一个搜索框,调用deepseek的API