Run youtube-dl inside docker.
Docker image generated daily with the latest version of Alpine Linux and youtube-dl.
youtube-dl is a command-line program to download videos from YouTube.com and a few more sites.
Install docker: https://docs.docker.com/engine/installation/
Install docker compose: https://docs.docker.com/compose/install/
Docker documentation: https://docs.docker.com/
-
build docker image
docker build -t youtube-dl .
-
list youtube-dl options:
docker run --rm youtube-dl --help
-
download a video:
docker run --rm -v $(pwd):/media youtube-dl https://www.youtube.com/watch?v=JYwUUDdYi9I
Create shortcut & execute command as,
alias yt-dl='docker run \
--rm -i \
-e PGID=$(id -g) \
-e PUID=$(id -u) \
-v "$(pwd)":/media:rw \
youtube-dl:latest'
- list youtube-dl options:
yt-dl --help
To download 1080p run the following command,
yt-dl -f 'bestvideo[height<=1080]+bestaudio/best[height<=1080]' --merge-output-format mp4 <YOUTUBE_URL_LINK>
-
pull docker image from docker hub:
docker pull kijart/youtube-dl
-
download a video using docker image:
docker run --rm -v $(pwd):/media kijart/youtube-dl https://www.youtube.com/watch\?v\=JYwUUDdYi9I
-
create a docker container
docker create \
--name=youtube-dl \
-v <path to data>:/media \
kijart/youtube-dl
-
create a container using docker-compose:
docker-compose up --no-start
-
download a video using docker compose:
docker-compose run --rm youtube-dl https://www.youtube.com/watch\?v\=JYwUUDdYi9I
-
youtube-dl.conf configuration file can be updated before build/rebuild the docker image: youtube-dl configuration file options
-
youtube-dl command-line options documentation