2020-04-01 01:46:28 +01:00
|
|
|
# docker build
|
|
|
|
|
|
|
|
> Build an image from a Dockerfile.
|
|
|
|
> More information: <https://docs.docker.com/engine/reference/commandline/build/>.
|
|
|
|
|
2024-03-14 05:01:06 +00:00
|
|
|
- Build a Docker image using the Dockerfile in the current directory:
|
2020-04-01 01:46:28 +01:00
|
|
|
|
|
|
|
`docker build .`
|
|
|
|
|
2024-03-14 05:01:06 +00:00
|
|
|
- Build a Docker image from a Dockerfile at a specified URL:
|
2020-04-01 01:46:28 +01:00
|
|
|
|
|
|
|
`docker build {{github.com/creack/docker-firefox}}`
|
|
|
|
|
2024-03-14 05:01:06 +00:00
|
|
|
- Build a Docker image and tag it:
|
2020-04-01 01:46:28 +01:00
|
|
|
|
|
|
|
`docker build --tag {{name:tag}} .`
|
|
|
|
|
2024-03-14 05:01:06 +00:00
|
|
|
- Build a Docker image with no build context:
|
2021-06-25 21:20:54 +01:00
|
|
|
|
|
|
|
`docker build --tag {{name:tag}} - < {{Dockerfile}}`
|
|
|
|
|
2020-04-01 01:46:28 +01:00
|
|
|
- Do not use the cache when building the image:
|
|
|
|
|
|
|
|
`docker build --no-cache --tag {{name:tag}} .`
|
|
|
|
|
2024-03-14 05:01:06 +00:00
|
|
|
- Build a Docker image using a specific Dockerfile:
|
2020-04-01 01:46:28 +01:00
|
|
|
|
|
|
|
`docker build --file {{Dockerfile}} .`
|
|
|
|
|
|
|
|
- Build with custom build-time variables:
|
|
|
|
|
|
|
|
`docker build --build-arg {{HTTP_PROXY=http://10.20.30.2:1234}} --build-arg {{FTP_PROXY=http://40.50.60.5:4567}} .`
|