FROM ubuntu:20.04 # ARG: Build-time variable, not available in the running container by default ARG APP_VERSION=1.0.0 ARG BUILD_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" # ENV: Runtime environment variable, also available during build after its declaration ENV PORT=8080 \ DEBUG_MODE=false LABEL version="$APP_VERSION" \ build_date="$BUILD_DATE" # Example of using ARG during build RUN echo "Building application version $APP_VERSION on $BUILD_DATE" # Example of using ENV after declaration RUN echo "Application will run on port $PORT" # You can pass build args with --build-arg during `docker build` # Example: docker build --build-arg APP_VERSION=1.1.0 -t myapp . # You can override ENV vars at runtime with -e during `docker run` # Example: docker run -e PORT=3000 myapp