apk not found error while changing to node-buster from Alpine base image

Viewed 893

I have changed my image in docker from Alpine base image to node:14.16-buster, While running the code I am getting 'apk not found' error.

Sharing the codes snippet :

FROM node:14.16-buster

# ========= steps for Oracle instant client installation (start) ===============
RUN apk --no-cache add libaio libnsl libc6-compat curl && \
    cd /tmp && \
    curl -o instantclient-basiclite.zip https://download.oracle.com/otn_software/linux/instantclient/instantclient-basiclite-linuxx64.zip -SL && \
    unzip instantclient-basiclite.zip && \
    mv instantclient*/ /usr/lib/instantclient && \
    rm instantclient-basiclite.zip

Can you please help here, what do I need to change?

3 Answers

The issue comes from the fact that you're changing your base image from Alpine based to Debian based.

Debian based Linux distributions use apt as their package manager (Alpine uses apk).

That is the reason why you get apk not found. Use apt install, but also keep in mind that the package names could differ and you might need to look that up. After all, apt is a different piece of software with it's own capabilities.

The buster node images are Debian based. buster is the release name for Debian 10 (11 will be bullseye).

Debian uses APT for packaging. apt-get can be used from scripts

apt-get update && apt-get install libaio1 curl

libnsl2 is not available in Buster, but you might not need it

Buster images are based on the Debian version.

It doesn't support the APK default package manger is APT

For example you can do :

FROM node:15.14.0-buster-slim

RUN apt-get update && \
    apt-get install -y \
      curl \
      jq \
      git \
      wget \
      openssl \
      bash \
      tar \
      net-tools && \
    rm -rf /var/lib/apt/lists/*

RUN mkdir /app && \
    chown node:node /app

APK is part of the Linux alpine version you have to change the base version if you want to use the APK.

Related