hen*_*zny 6 continuous-integration build docker dockerfile
docker build --output
--output , -o API 1.40+ 输出目的地(格式:type=local,dest=path)
我正在使用 docker 作为构建引擎,我希望找到一些为什么在docker build. 它会对此有帮助吗?
--output标志用于设置buildkit图像生成器的输出配置。buildkit可从docker 18.09发布中获得。您当前需要使用环境变量DOCKER_BUILDKIT=1才能使用 buildkit。
buildkit本身支持构建输出到不同的目的地,如docker 图像或本地目录,或者作为 docker tar ball 或 oci 格式的 tar ball。但是使用dockercli 工具,看起来您只能将构建输出导出到本地目录。
句法
--output type=local,dest=path/to/output-dir
Run Code Online (Sandbox Code Playgroud)
例子
root@vm1:~/cc# DOCKER_BUILDKIT=1 docker build -o type=local,dest=/root/cc/out .
[+] Building 0.5s (5/5) FINISHED
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 49B 0.0s
=> [internal] load metadata for docker.io/library/ubuntu:latest 0.0s
=> [1/1] FROM docker.io/library/ubuntu 0.0s
=> => resolve docker.io/library/ubuntu:latest 0.0s
=> exporting to client 0.5s
=> => copying files 64.40MB
# cd /root/cc/out
# ls -lrt
total 76
drwxr-xr-x 2 root root 4096 Apr 24 2018 sys
drwxr-xr-x 2 root root 4096 Apr 24 2018 proc
drwxr-xr-x 2 root root 4096 Apr 24 2018 home
drwxr-xr-x 2 root root 4096 Apr 24 2018 boot
drwxr-xr-x 2 root root 4096 Jan 12 13:09 srv
drwxr-xr-x 2 root root 4096 Jan 12 13:09 opt
drwxr-xr-x 2 root root 4096 Jan 12 13:09 mnt
drwxr-xr-x 2 root root 4096 Jan 12 13:09 media
drwxrwxrwt 2 root root 4096 Jan 12 13:10 tmp
drwxr-xr-x 2 root root 4096 Jan 12 13:10 dev
drwxr-xr-x 2 root root 4096 Jan 20 07:33 bin
drwxr-xr-x 29 root root 4096 Jan 20 07:33 etc
drwxr-xr-x 8 root root 4096 Jan 20 07:33 lib
drwxr-xr-x 5 root root 4096 Jan 20 07:33 run
drwx------ 2 root root 4096 Jan 20 07:33 root
drwxr-xr-x 2 root root 4096 Jan 20 07:33 lib64
drwxr-xr-x 2 root root 4096 Jan 20 07:33 sbin
drwxr-xr-x 10 root root 4096 Jan 20 07:33 usr
drwxr-xr-x 11 root root 4096 Jan 20 07:33 var
root@vm1:~/cc/out#
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2681 次 |
| 最近记录: |