Build an image from a Dockerfile
API 1.31+ The client and daemon API must both be at least 1.31 to use this command. Use the docker version
command on the client to check your client and daemon API versions.
docker builder build [OPTIONS] PATH | URL | -
Name, shorthand | Default | Description |
--add-host | Add a custom host-to-IP mapping (host:ip) | |
--build-arg | Set build-time variables | |
--cache-from | Images to consider as cache sources | |
--cgroup-parent | Optional parent cgroup for the container | |
--compress | Compress the build context using gzip | |
--cpu-period | Limit the CPU CFS (Completely Fair Scheduler) period | |
--cpu-quota | Limit the CPU CFS (Completely Fair Scheduler) quota | |
--cpu-shares , -c | CPU shares (relative weight) | |
--cpuset-cpus | CPUs in which to allow execution (0-3, 0,1) | |
--cpuset-mems | MEMs in which to allow execution (0-3, 0,1) | |
--disable-content-trust | true | Skip image verification |
--file , -f | Name of the Dockerfile (Default is ‘PATH/Dockerfile’) | |
--force-rm | Always remove intermediate containers | |
--iidfile | Write the image ID to the file | |
--isolation | Container isolation technology | |
--label | Set metadata for an image | |
--memory , -m | Memory limit | |
--memory-swap | Swap limit equal to memory plus swap: ‘-1’ to enable unlimited swap | |
--network |
API 1.25+ Set the networking mode for the RUN instructions during build | |
--no-cache | Do not use cache when building the image | |
--output , -o |
API 1.40+ Output destination (format: type=local,dest=path) | |
--platform |
experimental (daemon)API 1.32+ Set platform if server is multi-platform capable | |
--progress | auto | Set type of progress output (auto, plain, tty). Use plain to show container output |
--pull | Always attempt to pull a newer version of the image | |
--quiet , -q | Suppress the build output and print image ID on success | |
--rm | true | Remove intermediate containers after a successful build |
--secret |
API 1.39+ Secret file to expose to the build (only if BuildKit enabled): id=mysecret,src=/local/secret | |
--security-opt | Security options | |
--shm-size | Size of /dev/shm | |
--squash |
experimental (daemon)API 1.25+ Squash newly built layers into a single new layer | |
--ssh |
API 1.39+ SSH agent socket or keys to expose to the build (only if BuildKit enabled) (format: default| | |
--stream |
experimental (daemon)API 1.31+ Stream attaches to server to negotiate build context | |
--tag , -t | Name and optionally a tag in the ‘name:tag’ format | |
--target | Set the target build stage to build. | |
--ulimit | Ulimit options |
Command | Description |
---|---|
docker builder | Manage builds |
Command | Description |
docker builder build | Build an image from a Dockerfile |
docker builder prune | Remove build cache |
© 2019 Docker, Inc.
Licensed under the Apache License, Version 2.0.
Docker and the Docker logo are trademarks or registered trademarks of Docker, Inc. in the United States and/or other countries.
Docker, Inc. and other parties may also have trademark rights in other terms used herein.
https://docs.docker.com/engine/reference/commandline/builder_build/