7

I am trying to build my own docker container based on alpine linux and I need to add multiple services in that container (yes it is not recommended as best practice but at the moment my org devops is bit behind the curve and demanding a single dockerfile for my custom image).

I was checking this article to find the way to install the latest version of nodejs with npm on alpine linux. However there seems to be no apk add nodejs@6 or something like that provided in this discussion.

Also it appears that alpine linux does not have the latest version of nodejs (v 8.X) in the repository here.

So do I pretty much have to install nodejs from source? But that option is very slower compared to just installing from alpine repo.

EDIT:

adding nodejs-current in dockerfile is giving another problem

Step ... : RUN apk update && apk add nodejs-current

---> Running in e430b4d279e5 fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/main/x86_64/APKINDEX.tar.gz fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/community/x86_64/APKINDEX.tar.gz fetch http://nl.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz v3.4.6-213-gb6db4bd [http://dl-cdn.alpinelinux.org/alpine/v3.4/main] v3.4.6-160-g14ad2a3 [http://dl-cdn.alpinelinux.org/alpine/v3.4/community] v3.6.0-3765-g46dd4472f4 [http://nl.alpinelinux.org/alpine/edge/testing] OK: 8679 distinct packages available ERROR: unsatisfiable constraints: nodejs-current (missing): required by: world[nodejs-current]

  • You know, there's Unix & Linux for that. – user772515 Sep 22 '17 at 2:01
  • Well ... the nature of this question is such that it could be posted here also. – Andy Sep 24 '17 at 1:30
14

We provide two nodejs packages:

  • nodejs in main – LTS version,
  • nodejs-current in community – the current version, as its called by upstream.

So if you want the latest version, install nodejs-current by running:

apk add nodejs-current

Currently it’s 7.10.1 in v3.6 (stable branch) or 8.5.0 in edge (unstable/rolling branch).

We don’t use @N suffixes like nodejs@6, it’s not a valid package name.

  • I’ve explicitly stated that you should install nodejs-current from Alpine branch v3.6 or edge, but you’re using v3.4 repositories… v3.4 is quite old. And mixing v3.4 with current testing is extremely bad idea btw… – Jakub Jirutka Sep 26 '17 at 18:48
  • Oh OK! In that case, I will have to wait until the standard PHP image I am using (php:7.1.9-fpm-alpine) update their alpine repo to V3.6 (they use V3.4). – Andy Sep 26 '17 at 19:01
  • No, in that case you should stop using such horribly outdated image! Just use base alpine image and install php7-fpm package. – Jakub Jirutka Sep 26 '17 at 19:02
  • 2
    BTW The answer is right, it’s not my fault that you haven’t read it properly, so it’s quite rude to downvote it. – Jakub Jirutka Sep 26 '17 at 19:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.