English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
docker build The command is used to create an image using Dockerfile.
docker build [OPTIONS] PATH | URL -
OPTIONS description:
--build-arg=[] :Set variables when the image is created;
--cpu-shares :Set cpu usage weight;
--cpu-period :Limit CPU CFS period;
--cpu-quota :Limit CPU CFS quota;
--cpuset-cpus :Specify the CPU id to be used;
--cpuset-mems :Specify the memory id to be used;
--disable-content-trust :Ignore verification, default is enabled;
-f :Specify the path to the Dockerfile to be used;
--force-rm :Set to delete intermediate containers during the image process;
--isolation :Use container isolation technology;
--label=[] :Set the metadata used by the image;
-m :Set the maximum memory value;
--memory-swap :Set the maximum value of Swap to memory+swap,"-1"means unlimited swap;
--no-cache :The process of creating the image does not use the cache;
--pull :Attempt to update to the new version of the image;
--quiet, -q :Quiet mode, only the image ID is output after success;
--rm :Delete the intermediate container after the image is successfully set;
--shm-size :Set/dev/The size of shm, the default value is64M;
--ulimit :Ulimit configuration.
--squash :Compress all operations in the Dockerfile into a single layer.
--tag, -t: The name and tag of the image, usually in the format name:tag or name; multiple tags can be set for an image in a single build.
--network: Default default. Set the network mode of the RUN instruction during the build process
Create an image using the Dockerfile in the current directory, labeled as w3codebox/ubuntu:v1。
docker build -t w3codebox/ubuntu:v1 .
using URL github.com/creack/docker-firefox to create an image from the Dockerfile.
docker build github.com/creack/docker-firefox
You can also use -f The location of the Dockerfile:
$ docker build -f /path/to/a/Dockerfile .
Before executing the instructions in the Dockerfile within the Docker daemon, the Dockerfile is first checked for syntax. If there are syntax errors, it will return:
$ docker build -t test/myapp . Sending build context to Docker daemon 2.048 kB Error response from daemon: Unknown instruction: RUNCMD