在docker服务器上添加新的镜像后想在rancher中部署运行,通过docker image ls可以看到镜像存在,但是在通过rancher添加部署的时候却出现以下错误。
Failed to pull image "data-center-catalog:latest": rpc error: code = Unknown desc = Error response from daemon: pull access denied for data-center-catalog, repository does not exist or may require 'docker login'
系统没有找到镜像,检查yaml文件发现rancher默认使用了以下配置
- image: data-center-catalog:latest
imagePullPolicy: Always
name: data-center-catalogtest
imagePullPolicy标识总是从远程拉取镜像,但是我没有使用镜像服务,所以这里改为 IfNotPresent
- image: data-center-catalog:latest
imagePullPolicy: IfNotPresent
name:data-center-catalogtest
意思是如果监测到本地存在此镜像就不从远程拉取,删除现有pod重新添加pod成功部署
或者在配置部署的时候在 安全/主机设置 中修改镜像拉取策略 为 不存在则拉取