Home > Software engineering >  Settings path in ENV in Dockerfile get overruled?
Settings path in ENV in Dockerfile get overruled?

Time:05-04

I do something like this:

FROM registry.access.redhat.com/ubi8/python-39:1-48
USER root

ENV APP_ROOT=/jup\
    PY_PKG_DIR=${APP_ROOT}/src/app-pkg\
    ...

I copy files to that path:

COPY start-singleuser.sh jupyter_notebook_config.py ${PY_PKG_DIR}

I want to set my entrypoint dynamically:

ENTRYPOINT ["/bin/bash", "$PY_PKG_DIR/start-singleuser.sh"]

This does not work (path is NOT /jup/src/app-pkg, since the files are in a different location. I found them here:

opt/app-root/src/app-pkg

How does this happen? Is it possible in the baseimage to overrule my APP_ROOT Variable?

CodePudding user response:

if you want to use set one env var from another you should separate declaration, because variables in ENV won't be set until the command has completed

ENV APP_ROOT=/jup
ENV PY_PKG_DIR=${APP_ROOT}/src/app-pkg \
  • Related