RUN fails while installing Angular on Ubuntu Image
Finally managed to generate the docker image for Angular. Here are is the screnshot.

I am listing the contents of the Docker File along with the comments that explain the reasoning and my learnings.
# Created by Sridhar Pandurangiah - 29 October 2020
# This Docker file helps create the containers for the Angular User Interface
#1 We would like to create from the node image and then add the layers. I had initially started from a base image and proceeded to add Ubuntu, it did not work out as creating a ubuntu from the base involves a lot of work and its rather baseless to start from a base image. Then switched to starting from the Ubuntu image and the problems I faced is documented in this question. So had to start from the node image. Also remember that docker containers have to address a single concern.

FROM node:15.1.0 as ab-suite-image

#Add Information about this image
LABEL maintainer=&quot;sridhar@st.in&quot;
LABEL version=&quot;1.0&quot;
LABEL decsription=&quot;This is a docker image built from the node image and includes angular9 and metronic theme&quot;

#2 Add Angular and other peer dependencies that do not get installed by default to avoid the build from exiting with errors
RUN npm install -g @angular/cli@9.1.12 @angular/core @angular/common eslint chokidar jquery popper.js tslib --save

# Set environment variables for file locations if required

#3 Set the environment Variable to determine the environment where the application is deployed development | testing | staging | production
ENV AB_COMPLIANCE_ENV=development

#4 Set the working directory to copy the angular dependencies
WORKDIR /opt/ng

#5 We don't pull the code from GIT as it would mean storing the private ssh keys on a docker image that can be publicly accessed. This is is not advisable.
COPY package.json ./

#6 Update project dependencies using package.json. This stage is where we encountered a lot of issues with build failing as the shell scripts were returing errors. the flag --legacy-peer-deps ensures that the npm doesn't throw errors so the docker build continues
RUN npm install --legacy-peer-deps

#7 Copy all the other project files and build
COPY . ./
RUN ng build


#8 Configure Volumes if required

#9 Copy start Script if required
#COPY start.sh /start.sh
#CMD [&quot;./start.sh&quot;]

#10 Expose Port for the application
EXPOSE 4200 443

This docker image can be used to for running unit and E2E tests.
Some literature on the web ask you to install nginx but not advisable. Run nginx on a seperate dedicated container. On production you can build the angular application with the &quot;prod&quot; flag and copy the files so that nginx can serve them.