Skip to content

Instantly share code, notes, and snippets.

@SpringMT
Last active February 24, 2019 13:01
Show Gist options
  • Save SpringMT/87c138cfa011968d7a6eb67620c82316 to your computer and use it in GitHub Desktop.
Save SpringMT/87c138cfa011968d7a6eb67620c82316 to your computer and use it in GitHub Desktop.
docker buildとkanikoでのビルドのCOPYの挙動の差分

使っているrepository https://github.com/SpringMT/kaniko_test

docker buildの結果

% docker build .                                                                                                                ~/kaniko_test
Sending build context to Docker daemon  84.99kB
Step 1/7 : FROM alpine
 ---> caf27325b298
Step 2/7 : RUN apk add tree
 ---> Using cache
 ---> e86ee38803f8
Step 3/7 : RUN mkdir /app
 ---> Using cache
 ---> 0e6b3d21af4c
Step 4/7 : RUN mkdir /app/api
 ---> Using cache
 ---> 773622bd4619
Step 5/7 : WORKDIR /app
 ---> Using cache
 ---> 8ef234fe1eac
Step 6/7 : COPY api /app/api/
 ---> 35847386b92a
Step 7/7 : RUN tree /app
 ---> Running in 057ef83fa050
/app
└── api
    └── api.txt

1 directory, 1 file
Removing intermediate container 057ef83fa050
 ---> f15dc84881b5
Successfully built f15dc84881b5

kanikoの結果

INFO[0003] Using files from context: [/workspace/api] 
INFO[0003] COPY api /app/api/ 
INFO[0003] Taking snapshot of files... 
INFO[0003] RUN tree /app 
INFO[0003] cmd: /bin/sh 
INFO[0003] args: [-c tree /app] 
/app
└── api
└── api.txt

1 directory, 1 file
INFO[0003] Taking snapshot of full filesystem... 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment