Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
$ docker build --no-cache -t demo-onbuild . | |
### REMOVED ### | |
Step 6/11 : RUN echo "First stage build time:"; env | grep VAR_ | |
---> Running in 2059bd2e7860 | |
First stage build time: | |
VAR_ARG=arg_value | |
VAR_ENV=env_value | |
Removing intermediate container 2059bd2e7860 | |
---> ec2a853d2c02 |
This file contains 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
# First stage | |
FROM debian as base | |
ENV VAR_ENV=env_value | |
ARG VAR_ARG=arg_value | |
ONBUILD ENV VAR_ENV_ONBUILD=onbuild_env_value | |
ONBUILD ARG VAR_ARG_ONBUILD=onbuild_arg_value | |
RUN echo "First stage build time:"; env | grep VAR_ | |
# Second stage | |
FROM base | |
RUN echo "Second stage build time:"; env | grep VAR_ |
This file contains 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
$ docker build --build-arg SOME_VAR=new-value --no-cache -t demo . | |
### REMOVED ### | |
Step 2/5 : ENV SOME_VAR=env-value | |
---> Running in 10d7cb325994 | |
Removing intermediate container 10d7cb325994 | |
---> dcab47c67952 | |
Step 3/5 : ARG SOME_VAR=arg-value | |
---> Running in 265c48974673 | |
Removing intermediate container 265c48974673 |
This file contains 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
$ docker build --no-cache -t demo . | |
### REMOVED ### | |
Step 2/5 : ENV SOME_VAR=env-value | |
---> Running in ed8e108898e4 | |
Removing intermediate container ed8e108898e4 | |
---> 43da9e8e6dd6 | |
Step 3/5 : ARG SOME_VAR=arg-value | |
---> Running in fb03d6097fb1 | |
Removing intermediate container fb03d6097fb1 |
This file contains 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
FROM ubuntu | |
ENV SOME_VAR=env-value | |
ARG SOME_VAR=arg-value | |
RUN echo "Build-time: SOME_VAR is set to ${SOME_VAR:-}" | |
CMD ["bash", "-c", "echo Run-time: SOME_VAR is set to ${SOME_VAR:-}"] |
This file contains 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
version: "3" | |
services: | |
hello_world: | |
container_name: ubuntu | |
image: ubuntu:latest | |
command: '/bin/sh -c "echo ${VARIABLE_ONE:-ONE}"' |
This file contains 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
version: "3" | |
services: | |
hello_world: | |
container_name: ubuntu | |
image: ubuntu:latest | |
environment: | |
VARIABLE_ONE: ONE | |
command: '/bin/sh -c "echo $$VARIABLE_ONE"' |
This file contains 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
version: "3" | |
services: | |
hello_world: | |
container_name: ubuntu | |
image: ubuntu:latest | |
command: '/bin/sh -c "echo $$VARIABLE_ONE"' |
This file contains 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
$ export VARIABLE_ONE=ONE |
NewerOlder