macos上rancher desktop安装与配置

Overview

[toc]

安装

rancher desktop优势:

  • 完全免费,可以替代docker desktop,并且体验更好
  • 开发环境,宿主机可以快速方便的启动或关闭k8s集群

安装rancher desktop比较简单:

  • 下载: https://rancherdesktop.io/ 根据macos芯片选择合适的安装包
  • 保证可以访问外网的情况下,双击安装即可,安装过程中会自己去下载需要的依赖包

设置

安装完rancher desktop之后,默认会在~/.rd/bin下安装了docker, helm,docker-compose等可执行文件,命令行执行: docker info可以查看信息。

1$ docker info

如果需要设置镜像地址,或者配置私服忽略https证书验证,按如下进行配置:

 1# 1,进入rancher实例
 2$ LIMA_HOME="$HOME/Library/Application Support/rancher-desktop/lima" "/Applications/Rancher Desktop.app/Contents/Resources/resources/darwin/lima/bin/limactl" shell 0
 3
 4# 2,配置实例下的/etc/docker/daemon.json
 5$ vi /etc/docker/daemon.json
 6{
 7 "registry-mirrors" : [
 8   "https://hub-mirror.c.163.com",
 9   "https://docker.mirrors.ustc.edu.cn"
10 ],
11 "insecure-registries" : [
12   "nexus.hkyx.com"
13 ],
14 "debug" : true,
15 "experimental" : true
16}
17# 3,退出rancher desktop,并重新启动后,再次执行docker info
18$ docker info

Docker info显示信息如下(可以看到Insecure Registries以及Registry Mirrors):

 1Client:
 2 Version:    24.0.6-rd
 3 Context:    rancher-desktop
 4 Debug Mode: false
 5 Plugins:
 6  buildx: Docker Buildx (Docker Inc.)
 7    Version:  v0.11.2
 8    Path:     /Users/mac/.docker/cli-plugins/docker-buildx
 9  compose: Docker Compose (Docker Inc.)
10    Version:  v2.22.0
11    Path:     /Users/mac/.docker/cli-plugins/docker-compose
12
13Server:
14 Containers: 21
15  Running: 11
16  Paused: 0
17  Stopped: 10
18 Images: 12
19 Server Version: 23.0.6
20 Storage Driver: overlay2
21  Backing Filesystem: extfs
22  Supports d_type: true
23  Using metacopy: false
24  Native Overlay Diff: true
25  userxattr: false
26 Logging Driver: json-file
27 Cgroup Driver: cgroupfs
28 Cgroup Version: 1
29 Plugins:
30  Volume: local
31  Network: bridge host ipvlan macvlan null overlay
32  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
33 Swarm: inactive
34 Runtimes: io.containerd.runc.v2 runc
35 Default Runtime: runc
36 Init Binary: docker-init
37 containerd version: 0cae528dd6cb557f7201036e9f43420650207b58
38 runc version: 860f061b76bb4fc671f0f9e900f7d80ff93d4eb7
39 init version: 
40 Security Options:
41  seccomp
42   Profile: builtin
43 Kernel Version: 6.1.57-0-virt
44 Operating System: Alpine Linux v3.18
45 OSType: linux
46 Architecture: x86_64
47 CPUs: 6
48 Total Memory: 11.69GiB
49 Name: lima-rancher-desktop
50 ID: 7a4210df-22d4-49f8-a71c-9dd2a29cb79b
51 Docker Root Dir: /var/lib/docker
52 Debug Mode: true
53  File Descriptors: 86
54  Goroutines: 87
55  System Time: 2023-11-08T01:42:22.566832341Z
56  EventsListeners: 0
57 Experimental: true
58 Insecure Registries:
59  nexus.hkyx.com
60  127.0.0.0/8
61 Registry Mirrors:
62  https://hub-mirror.c.163.com/
63  https://docker.mirrors.ustc.edu.cn/
64 Live Restore Enabled: false