示例
Dockerfile
FROM alpine:latest
ARG TAG=0.0.1
ARG PORT_ARG=3080
RUN apk add --no-cache bash
# 切换默认shell为bash
SHELL ["/bin/bash", "-c"]
RUN echo tag=$TAG
RUN echo port_tag=$PORT_ARG
构建
docker build --no-cache --progress plain --rm --build-arg TAG=0.0.3 --build-arg PORT_ARG=3000 --tag hello/world:0.0.3 .
运行
docker run hello/world:0.0.3
笔记
ARG
用来声明参数,语法为ARG <key>=<default-value>
,需要在在FROM
之后才会有作用build
时, 通过--build-arg
的方式传递,语法为--build-arg <key>=<value>
, 可以多组
It is with sad regret to inform you that because of the Covid pandemic BestLocalData.com is shutting down.
We have lost family members and colleagues and have decided to shut down BestLocalData.com
It was a pleasure serving you all these years. We have made all our databases available for $99 (All of it for $99) for those interested.
Kind Regards,
BestLocalData.com
Bryan