4

I am running a docker-compose file using node:latest. I noticed an issue with the timezone that I am trying to fix. Following an example I found online, I tried to install tzdata. This is not working as I keep getting apk not found errors. After finding this stackoverflow.com question, Docker Alpine /bin/sh apk not found, it seems to mirror my issue as I docker exec'ed into the container and found the apk command in the /sbin folder. I tried to do the following to make it work but I am still not able to access apk. From other articles I found, this seemed to be the way to resolve the issue but apk is still not found.

CMD export PATH=$PATH:$ADDITIONAL_PATH
RUN apk add --no-cache tzdata
ENV TZ=America/Chicago
user1790300
  • 2,143
  • 10
  • 54
  • 123

2 Answers2

7

node:latest is based on buildpack-deps, which is based on Debian. Debian does not use apk; it uses apt. You either want to use Debian's apt to install packages (apt-get install tzdata) or switch to node:alpine, which uses apk for package management.

chash
  • 3,975
  • 13
  • 29
  • I get this error this time, ERROR: Dockerfile parse error line 16: unknown instruction: APT-GET. The weird thing is that when I went into the console earlier to check the os version, I see Alpine listed even though I am running node:latest. – user1790300 Oct 02 '19 at 23:59
  • Make sure to prefix the apt-get command with RUN in your Dockerfile. – chash Oct 03 '19 at 00:32
0

You can use node:alpine which is based on alpine.

node:alpine
CMD export PATH=$PATH:$ADDITIONAL_PATH
RUN apk add --no-cache tzdata
ENV TZ=America/Chicago

node:-alpine

This image is based on the popular Alpine Linux project, available in the alpine official image. Alpine Linux is much smaller than most distribution base images (~5MB), and thus leads to much slimmer images in general.

Adiii
  • 54,482
  • 7
  • 145
  • 148