Colima 在 Mac 上创建一个虚拟机并在其中安装 Docker Runtime(默认),Mac 上通过 docker cli 进行访问和普通使用 docker cli 无差别
特点
- Intel and M1 Macs support
- Docker and Containerd support
- Port Forwarding
- Volume mounts
- Kubernetes
安装
brew install colima
启动
colima start
运行 Nginx容器
# 运行 nginx ➜ docker run -d -p 88:80 nginx:latest # 查看容器状态 ➜ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES f395ecbbfff4 nginx:latest "/docker-entrypoint.…" 2 minutes ago Up 2 minutes 0.0.0.0:88->80/tcp, :::88->80/tcp agitated_cori # 访问成功 ➜ curl 192.168.106.2:88
构建镜像
# 构建镜像 ➜ cat <<EOF | docker build -t nginx:colima - FROM nginx RUN echo '这是一个本地构建的nginx镜像' > /usr/share/nginx/html/index.html EOF ...Building 0.1s (6/6) FINISHED # 查看 ➜ docker images REPOSITORY TAG IMAGE ID CREATED SIZE nginx colima 5097bf8ad99c 26 hours ago 142MB
更换数据源
colima ssh
vim /Users/xxxx/.docker/daemon.json
示例:
{ "registry-mirrors": [ "http://hub-mirror.c.163.com"] } }
具体可以把自己设置在Docker Desktop设置中docker engine中配置复制到daemon.json保存
然后 exit 停止colima colima stop 重启colima colima start 再次尝试,就更新镜像源成功
标签:colima,Desktop,nginx,88,镜像,Docker,Colima,docker From: https://www.cnblogs.com/mhSui/p/16941609.html