I'm trying to install nodejs version 13.10.1 on alpine docker.
What I'm trying:
FROM python:2.7-alpine
ENV ALPINE_MIRROR "http://dl-cdn.alpinelinux.org/alpine"
RUN echo "${ALPINE_MIRROR}/edge/main" >> /etc/apk/repositories
RUN apk add --no-cache nodejs-current --repository="http://dl-cdn.alpinelinux.org/alpine/edge/community"
RUN node --version
But of course It's installed the current version in edge (where it isn't v13.10.1).
So how can I found and install nodejs v13.10.1 on alpine docker?
it doesn't look like there is a package nodejs-current version 13.10.1 at branch edge in community or main. see: https://pkgs.alpinelinux.org/packages?name=nodejs-current&branch=edge&repo=community
you can build your own version - see https://stackoverflow.com/a/53389225/2087704
you could use the specific image FROM node:13.10.1-alpine
Related
I'm trying to build a docker with python 3 and google-cloud-bigquery with the following docker file:
FROM python:3.10-alpine
RUN pip3 install google-cloud-bigquery
WORKDIR /home
COPY *.py /home/
ENTRYPOINT ["python3", "-u", "myscript.py"]
But getting errors on the pip3 install google-cloud-bigquery (too long for here)..
What's missing for installing this on python-alpine?
Looks like an incompatibility issue with the latest version of google-cloud-bigquery (>3) and numpy:
ERROR: Could not build wheels for numpy, which is required to install pyproject.toml-based projects
Try specifying a previous version, this works for me:
RUN pip3 install google-cloud-bigquery==2.34.4
Actually it seems like not a problem with numpy, which builds smoothly with all the dependency libs install, but rather with pyarrow, which does not support alpine+pip build. I've found a workaround by using alpine pre-built version of pyarrow. It is much easier than building pyarrow from source. This build works for me just fine:
FROM python:3.10.6-alpine3.16
RUN apk add --no-cache build-base linux-headers \
py3-apache-arrow=8.0.0-r0
# Copying pyarrow to site-package of actual python path. Alpine python path
# and python's docker hub path are different.
RUN mv /usr/lib/python3.10/site-packages/* \
/usr/local/lib/python3.10/site-packages/
RUN rm -rf /usr/lib/python3.10
RUN --mount=type=cache,target=/root/.cache/pip \
pip install google-cloud-bigquery==3.3.2
Update python version, alpine version and py3-apache-arrow version to install later versions. This is the latest one on the time of writing.
And make sure to remove build dependencies (build-base, linux-headers) for your release docker. I prefer multistage dockers for this.
Date: Tuesday October 5th, 2021
Node 10.x was released on 2018-04-24 (but that's the default version when using apt-get)
I have needs to have both Python and Node.js installed in running container. I can get the latest version of python in a container using:
FROM python:alpine
or
FROM python:buster <== Debian based
How do I get the latest version of node.js (16.10.0) installed on Debian (in a Docker container)
Whe I do this:
FROM python:buster
RUN apt-get update && \
apt-get install -y \
nodejs npm
I get these versions of node:
node: 10.24.0
npm 5.8.0
and when run in the container give a long statement about no longer being unsupported.
What's up with the package repo that 'apt-get' pulls from, that it will not install later versions of node (14.x or greater)?
If I pull from:
FROM python:alpine
and include these lines
RUN apk -v --no-cache --update add \
nodejs-current npm
I will get node 16.x version, which makes it easy. I don't have to do anything else.
Is there something equivalent for python:buster (Debian based)
I would really like a one or two liner in my Dockerfile and not a pages of instructions with a dozen commands to simply get node in the image.
I would appreciate any tested/proven reply. I am sure a number of others have the same question. Other stackoverflow articles on this subject are convoluted and do not provide the simple solution I am hoping to find that is available with pytyon:alpine
There is a reason I need python:debian and cannot use python:alpine in this one use case, otherwise I would chose the latter.
Is there a way some how to get a package repo maintainers attention to show me how to get a recent version (14..16), into the apt-get repository?
It appears many people are having issues with this.
You can use:
FROM python:buster
RUN apt-get update && \
apt-get install -y \
nodejs npm
RUN curl -fsSL https://deb.nodesource.com/setup_current.x | bash - && \
apt-get install -y nodejs
I have a Docker file with a base image of 'python:alpine'
I need both python and node.js installed in the container, so I start with a python image.
How do I install the latest version of node.js ('Current latest features' of node.js) in the container without specifying a version?
At the time of this post,
RUN apk -v --no-cache --update add nodejs
will install 'LTS Recommended for most users', and not 'current latest features'
Reference: https://nodejs.org/en
At the time of this post:
'LTS recommended for most users': 14.7.6
'Current latest features': 16.9.1
In this example, I want to have 16.9.1 installed instead of 14.7.6, but not specify a specific version in my Dockerfile
The purpose of this is to lower the maintenance on the Dockerfile, having it pull the latest 'Current - latest features version' always, without having to check the node.js site for a version number, and hard coding that into the Dockerfile.
See this:
"edge" is the name given to the current development tree of Alpine Linux. It consists of a APK repository called "edge" and contains the latest build of all available Alpine Linux packages. Those packages are updated on a regular basis.
And, nodejs-current is the package name for latest feature release, so you could use next:
apk add --no-cache nodejs-current --repository="http://dl-cdn.alpinelinux.org/alpine/edge/community"
Whole run:
/ # apk update
fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/community/x86_64/APKINDEX.tar.gz
v3.14.2-38-g27e4ada230 [https://dl-cdn.alpinelinux.org/alpine/v3.14/main]
v3.14.2-36-g70ff2140e8 [https://dl-cdn.alpinelinux.org/alpine/v3.14/community]
OK: 14938 distinct packages available
/ # apk search --no-cache nodejs-current --repository="http://dl-cdn.alpinelinux.org/alpine/edge/community"
fetch http://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/community/x86_64/APKINDEX.tar.gz
nodejs-current-doc-16.9.1-r0
nodejs-current-16.9.1-r0
nodejs-current-dev-16.9.1-r0
/ # apk add --no-cache nodejs-current --repository="http://dl-cdn.alpinelinux.org/alpine/edge/community"
fetch http://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/community/x86_64/APKINDEX.tar.gz
(1/8) Installing ca-certificates (20191127-r5)
(2/8) Installing brotli-libs (1.0.9-r5)
(3/8) Installing c-ares (1.17.2-r0)
(4/8) Installing libgcc (10.3.1_git20210424-r2)
(5/8) Installing nghttp2-libs (1.43.0-r0)
(6/8) Installing libstdc++ (10.3.1_git20210424-r2)
(7/8) Installing libuv (1.41.0-r0)
(8/8) Installing nodejs-current (16.9.1-r0)
Executing busybox-1.33.1-r3.trigger
Executing ca-certificates-20191127-r5.trigger
OK: 74 MiB in 22 packages
/ # node -v
v16.9.1
I'm trying to install docker-compose on Linux alpine 3.13 following the documentation at https://docs.docker.com/compose/install/
But when I try to install rust it throws the following error:
ERROR: unable to select packages:
so:libLLVM-11.so (no such package):
required by: rust-1.51.0-r0[so:libLLVM-11.so]
Anyone have any idea of how to fix this?
Since alpine 3.10, if you are in the container:
apk add --update docker-compose
Otherwise, on the dockerfile:
RUN apk add --update docker-compose
Note that this does not install docker, you should have it installed already
This worked for me on Alpine 3.13, you can also search for the packages on the official site.
apk add llvm11-libs --repository=http://dl-cdn.alpinelinux.org/alpine/edge/main
I tried installing node ver 0.8 on my ubuntu 12.04.It already has a node ver 0.6.12.The installation went suceesfully but when i type in
node --version
it still shows previous version.
i tried to remove previous version using sudo apt-get remove node but it says package node is not installed.But on trying node --version it shows 0.6.12
Why is it so??
The problem is, you need to replace the new location for node with the old in your PATH variable. If you have an old manual install, find the old path to node by running echo $PATH. Then run this command:
export PATH=${PATH%$OLD_NODE_PATH/bin*}$NEW_NODE_PATH/bin${PATH#$*OLD_NODE_PATH/bin}
Or if you are using an install from the apt-get repository, just run:
export PATH=$NEW_NODE_PATH/bin
And that should fix your problem. But there is a better way! The best tool to manage your node.js environment is NVM. It exactly like RVM for ruby and similar to virtualenv for python, if you are familiar with those tools. It allows you to switch versions of node and download new ones extremely efficiently, and is easy to use. Download and install with:
curl https://raw.github.com/creationix/nvm/master/install.sh | sh
Then add this line to your bash (assuming you are running a bash shell) where it will be loaded (I prefer .bash_login for the personal stuff although it is not loaded by default):
[[ -s $HOME/.nvm/nvm.sh ]] && . $HOME/.nvm/nvm.sh
Source your bash script or restart the terminal then enter this command:
nvm install 0.8.0 && nvm use 0.8.0
This should set you up just fine. Although not necessary, you should probably get rid of all the other node installs, for the sake of tidiness. Check out their github page but to get you started here is a quick overview:
nvm ls # list all installed versions of node
nvm ls-remote # list all available versions of node
nvm install 0.9.8 # download and install node v0.9.8
nvm use 0.8.0 # switch current environment to use node v0.8.0
nvm alias default 0.8.0 # set 0.8.0 as default, you can use 'nvm use default'
nvm deactivate # use system install of node
nvm run default app.js # run app.js with default node version
I had this issue until I followd the directions on
https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager
which included running:
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
first. Then running sudo apt-get install nodejs npm got me to 0.8.x
Also see: http://apptob.org/
Seem like you install nodejs package from Ubuntu repo and manually install node 0.8 after?
Try remove nodejs package.
The way to get a more recent version of Node.js is to add a PPA (personal package archive) maintained by NodeSource. This will probably have more up-to-date versions of Node.js than the official Ubuntu repositories.
First, you need to install the PPA in order to get access to its contents:
curl -sL https://deb.nodesource.com/setup | sudo bash -
The PPA will be added to your configuration and your local package cache will be updated automatically. After running the setup script from nodesource, you can install the Node.js package using the below command.
sudo apt-get install nodejs
You can check the node by using this command
node -v