Tuesday, 6 June 2017

Elastic Beanstalk Docker container running Node application exits early

I have an ElasticBeanstalk environment with docker that deploys a node application running restify. When we deploy new versions of the application we see intermittent failures with the error:

Command failed on instance. Return code: 1 Output: nginx: [emerg] no host in upstream ":8080" in /etc/nginx/conf.d/elasticbeanstalk-nginx-docker-upstream.conf:2 nginx: configuration file /etc/nginx/nginx.conf test failed Failed to start nginx, abort deployment. Hook /opt/elasticbeanstalk/hooks/appdeploy/enact/01flip.sh

When looking through the logs we see that the container exist with exit 0 meaning the application is returning that it has exited successfully.

Dockerfile:

FROM node:alpine
RUN mkdir -p /usr/src/app 
WORKDIR /usr/src/app

COPY .npmrc .npmrc   
COPY package.json /usr/src/app/ 
RUN npm install 
RUN rm -f .npmrc

COPY . /usr/src/app

EXPOSE 8080 CMD ["npm", "start"]



via user177466

No comments:

Post a Comment