简体   繁体   English

为什么“Skaffold”为每个 Dockerfile 创建两个图像?

[英]Why "Skaffold" creates two images for each Dockerfile?

This is my skaffild.yaml file:这是我的skaffild.yaml文件:

apiVersion: skaffold/v2alpha3
kind: Config
deploy:
  kubectl:
    manifests:
      - ./infra/k8s/*
build:
  local:
    push: false
  artifacts:
    - image: tester/auth
      context: auth
      docker:
        dockerfile: Dockerfile
      sync:
        manual:
          - src: 'src/**/*.ts'
            dest: .
    - image: tester/ticketing-client
      context: client
      docker:
        dockerfile: Dockerfile
      sync:
        manual:
          - src: '**/*.js'
            dest: .
    - image: tester/tickets
      context: tickets
      docker:
        dockerfile: Dockerfile
      sync:
        manual:
          - src: 'src/**/*.ts'
            dest: .
    - image: tester/orders
      context: orders
      docker:
        dockerfile: Dockerfile
      sync:
        manual:
          - src: 'src/**/*.ts'
            dest: .

And this is one of the Dockerfile s for example:这是Dockerfile之一,例如:

FROM node:alpine

WORKDIR /app
COPY package.json .
RUN npm install --only=prod
COPY . .

CMD ["npm", "start"]

I am using Docker-Desktop on Windows 10 locally.我在本地 Windows 10 上使用Docker-Desktop When I run skaffold dev command it creates two instance of each image, one with latest tag and the other one with a tag like 66fd1b7d90526513591c1af211f26c9d19d1c7415baac331246219a40a8e6ec0 .当我运行skaffold dev命令时,它会为每个图像创建两个实例,一个带有latest标签,另一个带有66fd1b7d90526513591c1af211f26c9d19d1c7415baac331246219a40a8e6ec0等标签。

Is it normal?正常吗? Why does it do that?为什么要这样做?

It appears that your tagPolicy is set to sha256 , which tags your docker image twice, once with the sha digest :66fd1b... and again with :latest .您的tagPolicy似乎设置为sha256 ,它两次标记您的 docker 图像,一次使用 sha digest :66fd1b... ,再次使用:latest Bit strange because your skaffold.yaml isn't explicitly setting the tagPolicy and the default is gitCommit .有点奇怪,因为您的 skaffold.yaml 没有明确设置tagPolicy并且默认设置为gitCommit

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM