docker build命令怎么使用

2023-04-07 18:55:00 docker build 命令

Docker build 命令用于创建一个新的镜像,通过指定一个或多个Dockerfile来实现。镜像将从指定的基础镜像中构建,并通过在Dockerfile中运行的命令来定制。

使用方法:

docker build [OPTIONS] PATH | URL | -

选项说明:

-t, --tag list Repository name (and optionally a tag) to be applied to the resulting image in case of success

--build-arg list Set build-time variables

--cache=true|false Enable or disable the Docker cache

--cgroup-parent="" Optional parent cgroup for the container

--cpu-shares="" CPU shares (relative weight)

--cpu-period="" Limit the CPU CFS (Completely Fair Scheduler) period

--cpu-quota="" Limit the CPU CFS (Completely Fair Scheduler) quota

--cpuset-cpus="" CPUs in which to allow execution (0-3, 0,1)

--cpuset-mems="" Memory nodes (MEMs) in which to allow execution (0-3, 0,1)

-f, --file="" Name of the Dockerfile (Default is 'PATH/Dockerfile')

--force-rm=true|false Always remove intermediate containers

--help=false Print usage

--memory="" Memory limit

--memory-swap="" Total memory limit (memory + swap), '-1' to disable swap

--rm=true|false Remove intermediate containers after a successful build (defaults to true)

--shm-size="" Size of /dev/shm

-q, --quiet=false Suppress the verbose output generated by the containers

--ulimit list Ulimit options

PATH Path to the build context

URL URL of the remote context

- Read the build context from STDIN

相关文章