Build an image from a Dockerfile 通过Dockerfile文件构建镜像
用法
1
docker build [OPTIONS] PATH | URL | -
选项
1 2 3 4 5 6 7 8
Options: --file , -f 指定Dockerfile文件 (Default is 'PATH/Dockerfile') --label Set metadata for an image --no-cache Do not use cache when building the image --pull Always attempt to pull a newer version of the image --quiet , -q 静默模式,不显示构建过程,只在构建成功后显示镜像ID --rm Remove intermediate containers after a successful build, default is true --tag , -t 指定tag标记,格式为name:tag
# centos7默认的git版本不支持直接通过URL构建,需要使用ius源安装最新的git222 $ git version git version 1.8.3.1 # centos7卸载默认的git,然后通过ius源安装新版git $ git version git version 2.22.5 # ubuntu20.04默认的git版本可以直接通过URL构建 # git version git version 2.17.1