EN VI

Docker - Install yt-dlp in node:16.3.0-alpine base image?

2024-03-11 10:30:05
How to Docker - Install yt-dlp in node:16.3.0-alpine base image

This is my Dockerimage:

FROM node:16.3.0-alpine

WORKDIR /home/node/app

RUN apk update
RUN apk upgrade
RUN apk add --no-cache ffmpeg
RUN apk add --no-cache python3
RUN apk add --no-cache yt-dlp

When I try to build it fails at the yt-dlp step:

fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/community/x86_64/APKINDEX.tar.gz
ERROR: unable to select packages:
  yt-dlp (no such package):
    required by: world[yt-dlp]
The command '/bin/sh -c apk add --no-cache yt-dlp' returned a non-zero code: 1

I don't understand why it can't find the package since it clearly exist in the community repo, which is enabled by default in the alpine image I'm using.

PD: I need the node base image to be version 16 because the app I'm trying to run (wiki.js in its last stable release) runs in node 16

Solution:

By using the latest Node 16 version 16.20 you can successfully use yt-dlp.

Here is a working Dockerfile:

FROM node:16-alpine
RUN apk update && apk add --no-cache yt-dlp
Answer

Login


Forgot Your Password?

Create Account


Lost your password? Please enter your email address. You will receive a link to create a new password.

Reset Password

Back to login