├── .env ├── netease-cloud-music ├── files │ └── entrypoint.sh └── Dockerfile ├── docker-compose.yaml └── README.md /.env: -------------------------------------------------------------------------------- 1 | COMPOSE_PROJECT_NAME=netease-cloud-music 2 | -------------------------------------------------------------------------------- /netease-cloud-music/files/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ex 3 | 4 | export USERNAME=music 5 | export HOME=/home/$USERNAME 6 | export USER_ID=$(id -u) 7 | export GROUP_ID=$(id -g) 8 | 9 | cp -f /etc/passwd /tmp/passwd.template 10 | echo '${USERNAME}:x:${USER_ID}:${GROUP_ID}::${HOME}:/bin/bash' >> /tmp/passwd.template 11 | 12 | envsubst < /tmp/passwd.template > /tmp/passwd 13 | export LD_PRELOAD=/usr/lib/libnss_wrapper.so 14 | export NSS_WRAPPER_PASSWD=/tmp/passwd 15 | export NSS_WRAPPER_GROUP=/etc/group 16 | 17 | umask 0002 18 | exec "$@" 19 | -------------------------------------------------------------------------------- /docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: "2.1" 2 | services: 3 | app: 4 | image: docker.io/rayson/netease-cloud-music:latest 5 | build: netease-cloud-music 6 | environment: 7 | DISPLAY: 8 | PULSE_SERVER: unix:$XDG_RUNTIME_DIR/pulse/native 9 | LANG: zh_CN.GBK 10 | ipc: host 11 | volumes: 12 | - /tmp/.X11-unix/:/tmp/.X11-unix/:rw 13 | - $XDG_RUNTIME_DIR/pulse/native:$XDG_RUNTIME_DIR/pulse/native:rw 14 | - netease-cloud-music-config:/home/music/.config/netease-cloud-music:rw 15 | - netease-cloud-music-cache:/home/music/.cache/netease-cloud-music:rw 16 | - $HOME/Music:/home/music/Music:ro 17 | - $HOME/Music/CloudMusic:/home/music/Music/CloudMusic:rw 18 | user: "${UID}" 19 | volumes: 20 | netease-cloud-music-config: 21 | netease-cloud-music-cache: 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Netease Cloud Music in Docker Container 2 | 3 | Docker image of Netease Cloud Music (网易云音乐) for Linux. 4 | 5 | Netease Cloud Music (网易云音乐) is one of the most popular music players in China. 6 | 7 | ## Background 8 | 9 | ### Why creating this image 10 | 11 | - Since Netease Cloud Music for Linux is **NOT** an open source software, 12 | users like me don't want to run it directly on host for safety reasons. 13 | 14 | - It is not available for Linux distributions other than Ubuntu and deepin. 15 | 16 | ## Preconditions 17 | 18 | 1. You must have Docker and Docker Compose installed: 19 | 20 | - [Docker 1.12+](https://docs.docker.com/engine/installation/) 21 | - [Docker Compose 1.10+](https://docs.docker.com/compose/install/) 22 | 23 | 2. Make sure your music library is accessible by the root group 24 | (the music player inside the container will be run under the root group): 25 | 26 | ``` bash 27 | mkdir -p $HOME/Music && chgrp -hR 0 $HOME/Music && chmod -R g=rX $HOME/Music 28 | mkdir -p $HOME/Music/CloudMusic && chgrp -hR 0 $HOME/Music/CloudMusic && chmod -R g=rwX $HOME/Music/CloudMusic 29 | ``` 30 | 31 | ## Usage 32 | 33 | - Pull the image from Docker Hub: 34 | 35 | ``` bash 36 | docker-compose pull 37 | ``` 38 | 39 | - Run in the background: 40 | 41 | ``` bash 42 | docker-compose up -d 43 | ``` 44 | 45 | - Stop: 46 | 47 | ``` bash 48 | docker-compose down 49 | ``` 50 | 51 | ## (FOR DEVELOPERS) Build 52 | ``` bash 53 | docker-compose build 54 | ``` 55 | 56 | -------------------------------------------------------------------------------- /netease-cloud-music/Dockerfile: -------------------------------------------------------------------------------- 1 | # Dockerfile for netease-cloud-music 2 | FROM docker.io/ubuntu:16.04 3 | LABEL name=netease-cloud-music \ 4 | version=1.0.0 \ 5 | release=2 \ 6 | maintainer='Yuxiang Zhu ' 7 | 8 | ARG NETEASE_CLOUD_MUSIC_URL=http://d1.music.126.net/dmusic/netease-cloud-music_1.1.0_amd64_ubuntu.deb 9 | 10 | RUN \ 11 | apt-get update && \ 12 | apt-get install -y --no-install-recommends wget && \ 13 | wget -O /tmp/netease-cloud-music.deb "$NETEASE_CLOUD_MUSIC_URL" && \ 14 | apt-get install -y --no-install-recommends /tmp/netease-cloud-music.deb && \ 15 | rm /tmp/netease-cloud-music.deb && \ 16 | apt-get install -y --no-install-recommends dbus-x11 libcanberra-gtk-module \ 17 | packagekit-gtk3-module ca-certificates fonts-wqy-zenhei locales \ 18 | libnss-wrapper gettext && \ 19 | rm -rf /var/lib/apt/lists/* && \ 20 | localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 && \ 21 | cp -rT /etc/skel /home/music && chgrp -R 0 /home/music && chmod -R g+rwX /home/music && \ 22 | mkdir -p /home/music/.cache/netease-cloud-music /home/music/.config/netease-cloud-music /home/music/Music/CloudMusic && \ 23 | chgrp -hR 0 /home/music/.cache/netease-cloud-music /home/music/.config/netease-cloud-music /home/music/Music/CloudMusic && \ 24 | chmod g+rwX /home/music/.cache/netease-cloud-music /home/music/.config/netease-cloud-music /home/music/Music/CloudMusic 25 | 26 | COPY files/ / 27 | ENTRYPOINT ["/entrypoint.sh"] 28 | CMD ["/usr/bin/netease-cloud-music", "--no-sandbox"] 29 | USER 1000 30 | ENV LANG=zh_CN.UTF-8 31 | 32 | --------------------------------------------------------------------------------