title: Display logs when starting a Docker container
body: <p>I have containerized an Angular application as following. The container runs and I can access the UI in local environment. However, once pushed to organization's docker hub and deployed in Kubernetes cluster, I get 502 Bad Gateway from nginx when trying to access the url. I want to log information when starting the container to identify the problem. However since I have built the Angular app for production as a static app, I get logs only when the url is loaded. How can I log to console when starting this container, So that I can debug and identify the problem, when deploying in the cluster.</p>
  <blockquote>
  <p>Dockerfile</p>
  </blockquote>
  <pre><code>## Stage 1
  FROM node:10-alpine as build-step
  RUN mkdir -p /app
  WORKDIR /app
  COPY package.json /app
  RUN npm install
  COPY . /app
  RUN npm run build --prod
  
  ## Stage 2
  FROM nginx:1.17.1-alpine
  COPY nginx.config /etc/nginx/conf.d/default.conf
  COPY --from=build-step /app/dist/cfss-dashboard /usr/share/nginx/html
  
  ## Expose port 80
  EXPOSE 80
  </code></pre>
  <blockquote>
  <p>nginx.config</p>
  </blockquote>
  <pre><code>server {
    listen   80;
  
    root /usr/share/nginx/html;
    index index.html;
  
    server_name #########;
  
    location /cfss-dashboard-ui {
        try_files $uri /index.html;
    }
  
    access_log  /var/log/nginx/access.log;
    error_log  /var/log/nginx/error.log debug;
  }
  </code></pre>