您当前的位置:首页 > 网站建设 > 网站维护
| php | asp | css | H5 | javascript | Mysql | Dreamweaver | Delphi | 网站维护 | 帝国cms | React | 考试系统 | ajax | jQuery |

MacOS

51自学网 2023-07-14 22:03:54
  网站维护

本文讲述主要是基于Mac电脑安装教程,使用的是homebrew安装,未安装homebrew的请先自行安装下

一、使用 Homebrew 安装

macOS 我们可以使用 Homebrew 来安装 Docker。Homebrew 的 Cask 已经支持 Docker for Mac,因此可以很方便的使用 Homebrew Cask 来进行安装。

1. 输入安装命令如下:

brew install --cask --appdir=/Applications docker  # 1.输入安装命令==> Creating Caskroom at /usr/local/Caskroom==> We'll set permissions properly so we won't need sudo in the futurePassword:          # 2.输入你的macOS 密码==> Satisfying dependencies==> Downloading https://download.docker.com/mac/stable/21090/Docker.dmg#################################################################### 100.0%==> Verifying checksum for Cask docker==> Installing Cask docker==> Moving App 'Docker.app' to '/Applications/Docker.app'.🍺  docker was successfully installed!

最后如果提示了successfully installed! 字样就表示安装成功了

2. 安装完毕后,从应用中找到Docker 图标点击运行。可能会询问 macOS 登陆密码,输入即可

3. 打开终端,输入命令显示docker的版本信息

wpf@B-L0Q0JHD2-2029 ~ % docker --version  # 1.该命令仅显示安装版本Docker version 20.10.22, build 3a2c30bwpf@B-L0Q0JHD2-2029 ~ % docker version    # 2.该命令显示docker具体版本信息Client:  # 客户端信息 Cloud integration: v1.0.29 Version:           20.10.22 API version:       1.41 Go version:        go1.18.9 Git commit:        3a2c30b Built:             Thu Dec 15 22:28:41 2022 OS/Arch:           darwin/amd64 Context:           default Experimental:      trueServer: Docker Desktop 4.16.1 (95567) # 服务器信息 Engine:  Version:          20.10.22  API version:      1.41 (minimum version 1.12)  Go version:       go1.18.9  Git commit:       42c8b31  Built:            Thu Dec 15 22:26:14 2022  OS/Arch:          linux/amd64  Experimental:     false containerd:  Version:          1.6.14  GitCommit:        9ba4b250366a5ddde94bb7c9d1def331423aa323 runc:  Version:          1.1.4  GitCommit:        v1.1.4-0-g5fd4c4d docker-init:  Version:          0.19.0  GitCommit:        de40ad0wpf@B-L0Q0JHD2-2029 ~ % 

 4. 试运行docker,使用docker run 运行 hello-world镜像

  • doker 拉取hello-world镜像:docker pull hello-world
  • 运行拉取hello-world镜像:docker run hello-world

译:当运行容器时,使用的镜像如果在本地中不存在,docker 就会自动从 docker 镜像仓库中下载,默认是从 Docker Hub 公共镜像源下载。

wpf@B-L0Q0JHD2-2029 ~ % docker run hello-world # 运行hello-worldUnable to find image 'hello-world:latest' locally  # 提示未找到hello-world镜像latest: Pulling from library/hello-world # 尝试拉取远程官方library下的h-w镜像2db29710123e: Pull complete  # 拉取完毕了,后面是签名信息Digest: sha256:aa0cc8055b82dc2509bed2e19b275c8f463506616377219d9642221ab53cf9feStatus: Downloaded newer image for hello-world:latestHello from Docker!  # 显示这句话说明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 bashShare 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/wpf@B-L0Q0JHD2-2029 ~ % 

5. 我们可以使用 docker images 命令来列出本地主机上的镜像。

或者直接打开Docker Desktop应用 

二、Docker底层运行原理

docker 是一个c/s结构的系统(client客户端/server服务端)。

Docker的守护进程运行在宿主主机上,通过socket从客户端访问。DockerServer 接收到 Docker-Client的指令,就会执行这个指令。

Docker会以root权限运行它的守护进程,来处理普通Linux用户无法完成的操作(如挂载文件系统等操作)


下载地址:
nginx代理返回代码499问题分析与处理
docker

51自学网自学EXCEL、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。
京ICP备13026421号-1