-
build
Dockerfile
The command is used to create an image using -
grammar:
$ docker build [OPTIONS] PATH | URL | -
-
OPTIONS
illustrate# 可通过帮助命令查看 $ docker build --help
--build-arg=[]
: Set the variable when the image is created--cpu-shares
: setcpu
usage weight--cpu-period
: limitCPU
,CFS
cycle--cpu-quota
: limitCPU
,CFS
quota--cpuset-cpus
: designated to useCPU id
--cpuset-mems
: designated to use内存 id
--disable-content-trust
: Ignore validation, enabled by default-f
Dockerfile
: specifies the path to use--force-rm
: Delete intermediate containers during mirroring--isolation
: Use container isolation technology--label=[]
: Set the metadata used by the image-m
: set the maximum memory--memory-swap
:Swap
The maximum value of setting is memory +swap
, "-1" means no limitswap
--no-cache
: The process of creating the image does not use the cache--pull
: try to update the new version of the image--quiet, -q
: Quiet mode, only output after success镜像 ID
--rm
: Delete the intermediate container after successfully setting the image--shm-size
: set/dev/shm
the size of the , the default value is64M
--ulimit
:Ulimit
configuration--squash
:Dockerfile
Compress all operations in to one layer--tag, -t
: The name and label of the image, usuallyname:tag
orname
The format can set multiple labels for an image in one build--network
: defaultdefault
Sets the network mode of the RUN instruction during build
-
Extended case
# -t 给镜像加一个 Tag # ImageName 给镜像起的名称 # TagName 给镜像的Tag名 # dir Dockerfile所在目录 # $ docker build -t ImageName:TagName dir # test-redis:镜像名 # v1.1:tag 标签 # .:表示当前目录,即 Dockerfile 所在目录 $ docker build -t test-redis:v1.1 .
Detailed explanation of Docker build command
Guess you like
Origin blog.csdn.net/zz00008888/article/details/132060704
Recommended
Ranking