Last active
May 8, 2016 16:41
-
-
Save dfang/b0af452d4202503b084594c77e924fa9 to your computer and use it in GitHub Desktop.
Dockfile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```Dockerfile | |
FROM busybox | |
ARG EXPOSED_PORTS | |
ENV EXPOSED_PORTS ${EXPOSED_PORTS:-20000} | |
RUN echo ${EXPOSED_PORTS} | |
EXPOSE ${EXPOSED_PORTS} | |
``` | |
这种写法也可以不传 --build-arg | |
docker build -t test . | |
docker build --build-arg EXPOSED_PORTS="10001 10002" -t test . | |
关键在于第三行 | |
https://docs.docker.com/engine/reference/builder/#environment-replacement | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment