---
title: ".dockerignore文件的作用"
author: "cakin24"
date: "2017-11-11T20:40:19Z"
tags: []
categories: ["开源软件"]
slug: "dockerignore"
draft: false
lastmod: "2017-11-11T20:40:19Z"
id: 2399433
url: "https://cakin24.iteye.com/blog/2399433"
---

一 作用

配合ADD和COPY使用，.dockerignore文件排除构建镜像时不需要的文件或目录。

 

二 一些示例

\# comment

\*/temp*

\*/\*/temp*

temp?

 

\*.md

!README.md

 

\*.md

!README\*.md

README-secret.md

 

\*.md

README-secret.md

 

!README\*.md