docker-node
docker-node copied to clipboard
Wrong time in new Date
https://github.com/nodejs/docker-node/issues/626
Having this same issue on node:10-alpine. Tried solution from issue above and whatever I could find in gliderlabs/docker-alpine/issues/136. But to no avail. When doing console.log(new Date()) the issue persists in node.js; time differs minus 2 hours from what busybox says when running the date command.
My Dockerfile
FROM node:10-alpine
ENV TZ=Europe/Amsterdam
RUN apk --update add \
tzdata \
&& cp /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \
&& apk del tzdata
RUN apk --no-cache --virtual temp add build-base \
autoconf \
curl
RUN apk --no-cache add zeromq-dev \
python2 && \
curl -Ls "https://github.com/dustinblackman/phantomized/releases/download/2.1.1/dockerized-phantomjs.tar.gz" | tar xz -C /
ENV PYTHON /usr/bin/python2
ADD ./bin /home/node/app/bin
ADD ./packages /home/node/app/packages
ADD ./package.json /home/node/app/package.json
ADD ./npm-shrinkwrap.json /home/node/app/npm-shrinkwrap.json
ADD ./lerna.json /home/node/app/lerna.json
WORKDIR /home/node/app
RUN npm ci
WORKDIR /home/node/app/packages/lib-helpers
RUN npm install zeromq --zmq-external
WORKDIR /home/node/app
RUN npm run bootstrap && \
npm rebuild && \
apk del temp
RUN find . -name ".env" -type f -delete
Node.js (> v10) doesn't use system's tzdata anymore, ICU has its own tzdata. Maybe is it a reason?
Node.js gets its timezone data from the ICU library, aka International Components for Unicode.