Home  >  Article  >  Operation and Maintenance  >  What does build mean in docker?

What does build mean in docker?

WBOY
WBOYOriginal
2022-08-16 17:38:596331browse

In docker, build means "create"; this command is used to build a Docker image based on the given Dockerfile and context. The syntax is "docker build [OPTIONS] PATH | URL | -", Dockerfile It is a text file used to build an image. The text content contains the instructions and instructions required to build the image.

What does build mean in docker?

The operating environment of this tutorial: linux7.3 system, docker version 19.03, Dell G3 computer.

What does build mean in docker

The docker build command is used to create an image using a Dockerfile.

Syntax

docker build [OPTIONS] PATH | URL | -

OPTIONS Description:

  • --build-arg=[]: Set variables when creating the image;

  • --cpu-shares: Set cpu usage weight;

  • --cpu-period: Limit CPU CFS cycle;

  • --cpu-quota: Limit the CPU CFS quota;

  • --cpuset-cpus: Specify the CPU id used;

  • --cpuset-mems: Specify the memory id used;

  • --disable-content-trust: Ignore verification, enabled by default ;

  • -f: Specify the Dockerfile path to be used;

  • --force-rm: Delete the intermediate container during the mirroring 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 no limit swap;

  • --no-cache: The process of creating the image does not use cache;

  • --pull: Try to update the new image of the image Version;

  • --quiet, -q: Quiet mode, only the image ID will be output after success;

  • --rm: The image is set successfully Then delete the intermediate container;

  • --shm-size: Set the size of /dev/shm, the default value is 64M;

  • -- ulimit: Ulimit configuration.

  • --squash: Compress all operations in the Dockerfile into one layer.

  • --tag, -t: The name and tag of the image, usually in the format of name:tag or name; multiple tags can be set for one image in one build.

  • --network: default default. Set the network mode of the RUN command during build

##The example is as follows:

Use the Dockerfile in the current directory to create an image with the label runoob /ubuntu:v1.

docker build -t runoob/ubuntu:v1 .

Use the Dockerfile of URL github.com/creack/docker-firefox to create the image.

docker build github.com/creack/docker-firefox

You can also pass -f the location of the Dockerfile file:

$ docker build -f /path/to/a/Dockerfile .

Before the Docker daemon executes the instructions in the Dockerfile, it will first perform a syntax check on the Dockerfile. If there is a syntax error, it will return:

$ docker build -t test/myapp .
Sending build context to Docker daemon 2.048 kB
Error response from daemon: Unknown instruction: RUNCMD

What does build mean in docker?

Recommended learning: "

docker video tutorial"

The above is the detailed content of What does build mean in docker?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn