docker build

Build an image from a Dockerfile

Aliases

docker image build, docker build, docker builder build

Options

NameTypeDefaultDescription
--add-hostlistAdd a custom host-to-IP mapping (host:ip)
--build-arglistSet build-time variables
--cache-fromstringSliceImages to consider as cache sources
--cgroup-parentstringSet the parent cgroup for the RUN instructions during build
--compressboolCompress the build context using gzip
--cpu-periodint640Limit the CPU CFS (Completely Fair Scheduler) period
--cpu-quotaint640Limit the CPU CFS (Completely Fair Scheduler) quota
-c, --cpu-sharesint640CPU shares (relative weight)
--cpuset-cpusstringCPUs in which to allow execution (0-3, 0,1)
--cpuset-memsstringMEMs in which to allow execution (0-3, 0,1)
-f, --filestringName of the Dockerfile (Default is PATH/Dockerfile)
--force-rmboolAlways remove intermediate containers
--iidfilestringWrite the image ID to the file
--isolationstringContainer isolation technology
--labellistSet metadata for an image
-m, --memorybytes0Memory limit
--memory-swapbytes0Swap limit equal to memory plus swap: -1 to enable unlimited swap
--networkstringdefaultSet the networking mode for the RUN instructions during build
--no-cacheboolDo not use cache when building the image
--platformstringSet platform if server is multi-platform capable
--pullboolAlways attempt to pull a newer version of the image
-q, --quietboolSuppress the build output and print image ID on success
--rmbooltrueRemove intermediate containers after a successful build
--security-optstringSliceSecurity options
--shm-sizebytes0Size of /dev/shm
--squashboolSquash newly built layers into a single new layer
-t, --taglistName and optionally a tag in the name:tag format
--targetstringSet the target build stage to build.
--ulimitulimitUlimit options