When generating the nodejs image on Chapter 6: Building services with Docker, based on the book snippet, the nodejs version installed is 4.
the express app don't run on it.
Current book snippet
FROM ubuntu:16.04
LABEL maintainer="james@example.com"
ENV REFRESHED_AT 2016-06-01
RUN apt-get -yqq update
RUN apt-get -yqq install nodejs npm
RUN ln -s /usr/bin/nodejs /usr/bin/node
RUN mkdir -p /var/log/nodeapp
ADD nodeapp /opt/nodeapp/
WORKDIR /opt/nodeapp
RUN npm install
VOLUME [ "/var/log/nodeapp" ]
EXPOSE 3000
ENTRYPOINT [ "nodejs", "server.js" ]
To run the app container, I had to update node version to 10
My Dockerfile update
FROM ubuntu:16.04
LABEL maintainer="bruno@example.com"
ENV REFRESHED_AT 2018-12-02
RUN apt-get -yqq update
RUN apt-get -yqq install curl build-essential
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash
# nodejs package already includes npm
RUN apt-get install -y nodejs
# check node version
RUN echo $(nodejs -v)
# Create logs folder
RUN mkdir -p /var/log/nodeapp
# Add our local nodeapp folder to opt
ADD nodeapp /opt/nodeapp/
# use opt path as our working directory
WORKDIR /opt/nodeapp/
# install app dependencies
RUN npm install
# map the logs folder to a persistent volume in the host machine
VOLUME [ "/var/log/nodeapp" ]
# expose express app port
EXPOSE 3000
# fire-up node app
ENTRYPOINT [ "nodejs", "server.js" ]
Book version: v18.03.1-ce
When generating the nodejs image on
Chapter 6: Building services with Docker
, based on the book snippet, thenodejs
version installed is 4.the express app don't run on it.
Current book snippet
To run the app container, I had to update node version to 10
My Dockerfile update