eenvsubst not substitituing value for varable

I have an environment variable which is a form of json representation

export ENV={"outer":{"inner":{"key":"apiValue"}}}

When I substitute this value using envsubst

  • Docker isn't caching my RUN commands correctly
  • cant connect to docker tomcat container on windows - what am i doing wrong?
  • VS 2017 Add > Docker Support breaks build - “CleanWorkspace” task failed unexpectedly (console app)
  • Using Docker for Drupal Dev (Local)
  • Get list of containers/services of docker-compose from inside a container
  • How to copy docker images from one host to another?
  • envsubst < testenv > testapp
    

    It replaces with an empty string

    testenv

    JSON.parse($ENV).outer.inner.key
    

    testapp

    JSON.parse().outer.inner.key
    

    But if I set it to a simple value like export $ENV=syz this works as expected. Is this achievable?

    Here is a complete dockerfile

    FROM nodesource/jessie:0.12.7
    
    MAINTAINER 
    
    
    # Create app directory 
    RUN mkdir -p /usr/src/app
    WORKDIR /usr/src/app
    
    # cache package.json and node_modules to speed up builds
    ADD src src
    ADD package.json package.json
    ADD node_modules node_modules
    
    # Install packages for envsubst
    RUN apt-get update && apt-get upgrade -y --force-yes && rm -rf /var/lib/apt/lists/*;
    RUN apt-get update
    RUN apt-get install -y gettext-base
    
    # Substitute dependencies from environment variables
    RUN rm src/js/app.js
    RUN envsubst < src/js/envapp.js > src/js/app.js
    RUN npm install
    
    EXPOSE 8000
    CMD [ "npm", "start"]
    

  • How do you use ENV variables in CMD, on an Alpine based image?
  • Kubernetes populate with base image
  • Docker Layer's On Disk Location
  • Can't start working with docker
  • docker commit mysql doesn't save
  • Should swarm loadbalancing perform healthchecks on its nodes?
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.