Home > Operation and Maintenance > Docker > Introduction to the usage of build command

Introduction to the usage of build command

王林
Release: 2020-11-04 15:38:46
forward
10435 people have browsed it

Introduction to the usage of build command

After the Dockerfile is created, you can use the docker build command to build an image based on the Dockerfile.

(Programming video recommendation: java video tutorial)

1. First prepare the Dockerfile:

Introduction to the usage of build command

2 . Execute the build command:

docker build -t second:v1.0 .
Copy after login

Note that there is a point at the end. By default, "the file named Dockerfile under the context directory (Context) is used as the Dockerfile". Here, the Dockerfile in the current path is used to build.

-t second : v1.0 Name the newly built image second and set the version to v1.0.

Introduction to the usage of build command

#docker build: Command keyword to build the image using Dockerfile.

[OPTIONS]: Command options, commonly used instructions include

-t specifies the name of the image,

-f displays the Dockerfile file that specifies the built image (Dockerfile may not be the current one) path)

If -f is not used, the file named Dockerfile under the context path is considered to be the "Dockerfile" for building the image by default.

Context path|URL: Specify the path of the context for building the image. During the process of building the image, any file in the context can and can only be referenced.

3. You can use docker images to check whether the build is successful.

Related recommendations: docker tutorial

The above is the detailed content of Introduction to the usage of build command. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template