[GH-ISSUE #10] Create a docker image #8

Closed
opened 2026-02-26 02:31:46 +03:00 by kerem · 64 comments
Owner

Originally created by @SkinyMonkey on GitHub (Dec 14, 2015).
Original GitHub issue: https://github.com/koel/koel/issues/10

I don't have experience with the PHP ecosystem so I might have some problem doing it but if you help me It should be easy/quick to do.

Contact me!

Originally created by @SkinyMonkey on GitHub (Dec 14, 2015). Original GitHub issue: https://github.com/koel/koel/issues/10 I don't have experience with the PHP ecosystem so I might have some problem doing it but if you help me It should be easy/quick to do. Contact me!
kerem closed this issue 2026-02-26 02:31:46 +03:00
Author
Owner

@sammcj commented on GitHub (Dec 14, 2015):

+1

<!-- gh-comment-id:164440212 --> @sammcj commented on GitHub (Dec 14, 2015): +1
Author
Owner

@reyman commented on GitHub (Dec 14, 2015):

👍

<!-- gh-comment-id:164445345 --> @reyman commented on GitHub (Dec 14, 2015): :+1:
Author
Owner

@risq commented on GitHub (Dec 14, 2015):

👍

<!-- gh-comment-id:164449186 --> @risq commented on GitHub (Dec 14, 2015): :+1:
Author
Owner

@eladg commented on GitHub (Dec 14, 2015):

+1

<!-- gh-comment-id:164459086 --> @eladg commented on GitHub (Dec 14, 2015): +1
Author
Owner

@n2o commented on GitHub (Dec 14, 2015):

A docker container would be awesome!

<!-- gh-comment-id:164459347 --> @n2o commented on GitHub (Dec 14, 2015): A docker container would be awesome!
Author
Owner

@sg-s commented on GitHub (Dec 14, 2015):

+1

<!-- gh-comment-id:164470649 --> @sg-s commented on GitHub (Dec 14, 2015): +1
Author
Owner

@ColmHally commented on GitHub (Dec 14, 2015):

I like this project and would be happy to contribute a Docker image later tonight, unless someone else has started already?

<!-- gh-comment-id:164472179 --> @ColmHally commented on GitHub (Dec 14, 2015): I like this project and would be happy to contribute a Docker image later tonight, unless someone else has started already?
Author
Owner

@LuRsT commented on GitHub (Dec 14, 2015):

@ColmHally I was planning on doing it too, but since you stepped up first, go ahead :)

<!-- gh-comment-id:164472819 --> @LuRsT commented on GitHub (Dec 14, 2015): @ColmHally I was planning on doing it too, but since you stepped up first, go ahead :)
Author
Owner

@ColmHally commented on GitHub (Dec 14, 2015):

@LuRsT ha! Ok - when I've got something, would you mind reviewing? I'll probably add a docker-compose.yml file as well so the mysql dependency is in a separate container.

<!-- gh-comment-id:164476628 --> @ColmHally commented on GitHub (Dec 14, 2015): @LuRsT ha! Ok - when I've got something, would you mind reviewing? I'll probably add a `docker-compose.yml` file as well so the mysql dependency is in a separate container.
Author
Owner

@LuRsT commented on GitHub (Dec 14, 2015):

@ColmHally Sounds good! Yes, using docker compose is a good idea :)

<!-- gh-comment-id:164477379 --> @LuRsT commented on GitHub (Dec 14, 2015): @ColmHally Sounds good! Yes, using docker compose is a good idea :)
Author
Owner

@NamPNQ commented on GitHub (Dec 14, 2015):

I'm current doing it 💃

<!-- gh-comment-id:164484280 --> @NamPNQ commented on GitHub (Dec 14, 2015): I'm current doing it :dancer:
Author
Owner

@ColmHally commented on GitHub (Dec 14, 2015):

@NamPNQ cool!

<!-- gh-comment-id:164484731 --> @ColmHally commented on GitHub (Dec 14, 2015): @NamPNQ cool!
Author
Owner

@w0rd-driven commented on GitHub (Dec 14, 2015):

Since this is a laravel project you can use homestead, the preconfigured vagrant environment. Basic docs are here: http://laravel.com/docs/5.1/homestead.

I'd personally choose the Per Project Installation (http://laravel.com/docs/5.1/homestead#per-project-installation), run homestead make, and include the definitions in the repo.

I know this is specifically a docker thread but if you have no preference between docker and vagrant, the homestead VM is already setup to host laravel projects.

<!-- gh-comment-id:164488769 --> @w0rd-driven commented on GitHub (Dec 14, 2015): Since this is a laravel project you can use homestead, the preconfigured vagrant environment. Basic docs are here: http://laravel.com/docs/5.1/homestead. I'd personally choose the Per Project Installation (http://laravel.com/docs/5.1/homestead#per-project-installation), run `homestead make`, and include the definitions in the repo. I know this is specifically a docker thread but if you have no preference between docker and vagrant, the homestead VM is already setup to host laravel projects.
Author
Owner

@LuRsT commented on GitHub (Dec 14, 2015):

@w0rd-driven they both have their advantages and disadvantages, the project could support both if @phanan accepts.

<!-- gh-comment-id:164492184 --> @LuRsT commented on GitHub (Dec 14, 2015): @w0rd-driven they both have their advantages and disadvantages, the project could support both if @phanan accepts.
Author
Owner

@wmartins commented on GitHub (Dec 14, 2015):

+1

<!-- gh-comment-id:164502376 --> @wmartins commented on GitHub (Dec 14, 2015): +1
Author
Owner

@dellingera commented on GitHub (Dec 14, 2015):

+1

<!-- gh-comment-id:164570023 --> @dellingera commented on GitHub (Dec 14, 2015): +1
Author
Owner

@mpgirro commented on GitHub (Dec 14, 2015):

+1

<!-- gh-comment-id:164579481 --> @mpgirro commented on GitHub (Dec 14, 2015): +1
Author
Owner

@Lusitaniae commented on GitHub (Dec 14, 2015):

sounds interesting, can I see it as well?
Maybe I can give a hand

<!-- gh-comment-id:164580995 --> @Lusitaniae commented on GitHub (Dec 14, 2015): sounds interesting, can I see it as well? Maybe I can give a hand
Author
Owner

@telemakhos commented on GitHub (Dec 14, 2015):

+1

<!-- gh-comment-id:164582339 --> @telemakhos commented on GitHub (Dec 14, 2015): +1
Author
Owner

@samliu commented on GitHub (Dec 14, 2015):

+1

<!-- gh-comment-id:164583319 --> @samliu commented on GitHub (Dec 14, 2015): +1
Author
Owner

@extensionsapp commented on GitHub (Dec 14, 2015):

+1

<!-- gh-comment-id:164595325 --> @extensionsapp commented on GitHub (Dec 14, 2015): +1
Author
Owner

@kodeartisan commented on GitHub (Dec 15, 2015):

+1

<!-- gh-comment-id:164609677 --> @kodeartisan commented on GitHub (Dec 15, 2015): +1
Author
Owner

@hernandanielg commented on GitHub (Dec 15, 2015):

I would be happy to create a Vagrant and a docker image, but Idk if we will end doing the same thing at the same time... Someone could help me because I'm new here 🚶

<!-- gh-comment-id:164628211 --> @hernandanielg commented on GitHub (Dec 15, 2015): I would be happy to create a Vagrant and a docker image, but Idk if we will end doing the same thing at the same time... Someone could help me because I'm new here :walking:
Author
Owner

@phanan commented on GitHub (Dec 15, 2015):

image

<!-- gh-comment-id:164630220 --> @phanan commented on GitHub (Dec 15, 2015): ![image](https://cloud.githubusercontent.com/assets/8056274/11800898/b27154a0-a31b-11e5-8c54-d7e4294470a8.png)
Author
Owner

@NamPNQ commented on GitHub (Dec 15, 2015):

Hi friends,
I create branch for docker in here: https://github.com/NamPNQ/koel/tree/feature-docker
How to install via docker

$ cp .env.example .env
$ vi .env

Config admin info and db info

DB_HOST=db
DB_DATABASE=koel
DB_USERNAME=root
DB_PASSWORD=secret

Run docker

$ pip install docker-compose
$ docker-compose build
$ docker-compose run web php artisan migrate --force
$ docker-compose run web php artisan db:seed --force

It's done,..but i get error in larevel, i don't familar with larevel to solve it, anyone can help me to continue

<!-- gh-comment-id:164631156 --> @NamPNQ commented on GitHub (Dec 15, 2015): Hi friends, I create branch for docker in here: https://github.com/NamPNQ/koel/tree/feature-docker How to install via docker ``` $ cp .env.example .env $ vi .env ``` Config admin info and db info ``` DB_HOST=db DB_DATABASE=koel DB_USERNAME=root DB_PASSWORD=secret ``` Run docker ``` $ pip install docker-compose $ docker-compose build $ docker-compose run web php artisan migrate --force $ docker-compose run web php artisan db:seed --force ``` It's done,..but i get [error](http://laravel.io/forum/06-09-2015-no-supported-encrypter-found-the-cipher-and-or-key-length-are-invalid) in larevel, i don't familar with larevel to solve it, anyone can help me to continue
Author
Owner

@phanan commented on GitHub (Dec 15, 2015):

@NamPNQ You need to run php artisan key:generate to generate a key. But scratch that, @mattstauffer has added a php artisan init to cover key:generate migrate and db:seed. Please refer to the updated wiki.

<!-- gh-comment-id:164638704 --> @phanan commented on GitHub (Dec 15, 2015): @NamPNQ You need to run `php artisan key:generate` to generate a key. But scratch that, @mattstauffer has added a `php artisan init` to cover `key:generate` `migrate` and `db:seed`. Please refer to the [updated wiki](https://github.com/phanan/koel/wiki#installation).
Author
Owner

@NamPNQ commented on GitHub (Dec 15, 2015):

@phanan: I got my mistake, I set .env to enviroment, and when run app it not get in .env, it get in enviroment 💃

<!-- gh-comment-id:164639655 --> @NamPNQ commented on GitHub (Dec 15, 2015): @phanan: I got my mistake, I set `.env` to enviroment, and when run app it not get in `.env`, it get in enviroment :dancer:
Author
Owner

@sammcj commented on GitHub (Dec 15, 2015):

Thanks @NamPNQ , any chance you could swap out Apache for Nginx?
Generally Nginx is faster, lighter weight and more secure than Apache these days.

<!-- gh-comment-id:164644409 --> @sammcj commented on GitHub (Dec 15, 2015): Thanks @NamPNQ , any chance you could swap out Apache for Nginx? Generally Nginx is faster, lighter weight and more secure than Apache these days.
Author
Owner

@NamPNQ commented on GitHub (Dec 15, 2015):

@samliu Waiting #7 closed 👍

<!-- gh-comment-id:164650206 --> @NamPNQ commented on GitHub (Dec 15, 2015): @samliu Waiting #7 closed :+1:
Author
Owner

@phanan commented on GitHub (Dec 15, 2015):

RUN su root
RUN composer install
RUN chsh -s /usr/sbin/nologin www-data
RUN php artisan key:generate && php artisan config:clear

I don't think this is proper.

  • Composer should be run by www-data
  • php artisan key:generate should be replaced by php artisan init
  • php artisan config:clear why do we need this?
<!-- gh-comment-id:164657094 --> @phanan commented on GitHub (Dec 15, 2015): ``` RUN su root RUN composer install RUN chsh -s /usr/sbin/nologin www-data RUN php artisan key:generate && php artisan config:clear ``` I don't think this is proper. - Composer should be run by `www-data` - `php artisan key:generate` should be replaced by `php artisan init` - `php artisan config:clear` why do we need this?
Author
Owner

@sammcj commented on GitHub (Dec 15, 2015):

I'd suggest using the official PHP 7 FPM docker image as a base, then adding nginx and connecting to PostgreSQL to try and do away with MySQL / MariaDB.

github.com/docker-library/php@a9f7fed15b/7.0/fpm/Dockerfile

<!-- gh-comment-id:164679061 --> @sammcj commented on GitHub (Dec 15, 2015): I'd suggest using the official PHP 7 FPM docker image as a base, then adding nginx and connecting to PostgreSQL to try and do away with MySQL / MariaDB. https://github.com/docker-library/php/blob/a9f7fed15bc6bb03aa3648560ef4cb0ac79fb612/7.0/fpm/Dockerfile
Author
Owner

@NamPNQ commented on GitHub (Dec 15, 2015):

@phanan:
Composer should be run by www-data, fixed, i will pull request soon
php artisan config:clear, i had remove it
php artisan init include migrate db, but when build docker image is not link with db, we should be manual run it

<!-- gh-comment-id:164694898 --> @NamPNQ commented on GitHub (Dec 15, 2015): @phanan: `Composer should be run by www-data`, fixed, i will pull request soon `php artisan config:clear`, i had remove it `php artisan init` include migrate db, but when build docker image is not link with db, we should be manual run it
Author
Owner

@CedricGatay commented on GitHub (Dec 15, 2015):

You can also have a look at this https://github.com/CedricGatay/docker-koel, it is still a little rough around the edges and I hope to have enough time to clean it up before submitting a proper pull request (if nobody does it before me).

<!-- gh-comment-id:164756049 --> @CedricGatay commented on GitHub (Dec 15, 2015): You can also have a look at this https://github.com/CedricGatay/docker-koel, it is still a little rough around the edges and I hope to have enough time to clean it up before submitting a proper pull request (if nobody does it before me).
Author
Owner

@patrick-mota commented on GitHub (Dec 15, 2015):

I just started from alpine and I saw your issue..
I started from https://github.com/geshan/docker-php-composer-alpine/blob/master/Dockerfile to get php+composer from alpine as base.
And there is my Dockerfile... it was my first draft so some elements can be removed.
Anyway if you go with alpine don't forget to "apk add build-base" or you will be unable to npm install.

FROM geshan/php-composer-alpine:latest

RUN apk --update add php-mysql php-pdo_mysql php-mcrypt php-ctype php-xml python &&
apk add nodejs &&
apk add git &&
apk add build-base &&
rm /var/cache/apk/*

RUN git clone https://github.com/phanan/koel &&
cd koel &&
npm install &&
composer install

COPY config/.env .

RUN php artisan init &&
php artisan serve

<!-- gh-comment-id:164842324 --> @patrick-mota commented on GitHub (Dec 15, 2015): I just started from alpine and I saw your issue.. I started from https://github.com/geshan/docker-php-composer-alpine/blob/master/Dockerfile to get php+composer from alpine as base. And there is my Dockerfile... it was my first draft so some elements can be removed. Anyway if you go with alpine don't forget to "apk add build-base" or you will be unable to npm install. FROM geshan/php-composer-alpine:latest RUN apk --update add php-mysql php-pdo_mysql php-mcrypt php-ctype php-xml python &&\ apk add nodejs &&\ apk add git &&\ apk add build-base &&\ rm /var/cache/apk/* RUN git clone https://github.com/phanan/koel &&\ cd koel &&\ npm install &&\ composer install COPY config/.env . RUN php artisan init &&\ php artisan serve
Author
Owner

@jc21 commented on GitHub (Dec 15, 2015):

Definitely voting for a docker instance for this project. I have a docker image someone might be interested in as a base for these types of apps.

https://hub.docker.com/r/jc21/devserver/

  • Alpine linux
  • PHP 5.6 FPM
  • Nginx
  • Composer
  • Gulp
  • Bower

Copy and modify the dockerfile specifically for this app. Unfortunately I don't have the time atm.

<!-- gh-comment-id:164937000 --> @jc21 commented on GitHub (Dec 15, 2015): Definitely voting for a docker instance for this project. I have a docker image someone might be interested in as a base for these types of apps. https://hub.docker.com/r/jc21/devserver/ - Alpine linux - PHP 5.6 FPM - Nginx - Composer - Gulp - Bower Copy and modify the dockerfile specifically for this app. Unfortunately I don't have the time atm.
Author
Owner

@NamPNQ commented on GitHub (Dec 16, 2015):

Hey @CedricGatay, @patrick-mota , It look like docker for dev enviroment, I think it not necessary

<!-- gh-comment-id:164975046 --> @NamPNQ commented on GitHub (Dec 16, 2015): Hey @CedricGatay, @patrick-mota , It look like docker for dev enviroment, I think it not necessary
Author
Owner

@phanan commented on GitHub (Dec 16, 2015):

@CedricGatay Can you update your docker with Apache + PHP 7?

<!-- gh-comment-id:164995959 --> @phanan commented on GitHub (Dec 16, 2015): @CedricGatay Can you update your docker with Apache + PHP 7?
Author
Owner

@CedricGatay commented on GitHub (Dec 16, 2015):

@NamPNQ I am not a php dev so I don't know if laravel built in server is slow or something else. But I disagree on this being a dev environment : it would have less layers and code mounted as a volume instead of being integrated in the build.

@phanan if you think it can be better in term of performance, I can do this change (not until tomorrow I'm afraid though)

<!-- gh-comment-id:165015313 --> @CedricGatay commented on GitHub (Dec 16, 2015): @NamPNQ I am not a php dev so I don't know if laravel built in server is slow or something else. But I disagree on this being a dev environment : it would have less layers and code mounted as a volume instead of being integrated in the build. @phanan if you think it can be better in term of performance, I can do this change (not until tomorrow I'm afraid though)
Author
Owner

@NamPNQ commented on GitHub (Dec 16, 2015):

@CedricGatay I mean php artisan serve is not ment for use in production environments because it uses PHP5 build in webserver. Just serve app via Apache or Nginx.

<!-- gh-comment-id:165016284 --> @NamPNQ commented on GitHub (Dec 16, 2015): @CedricGatay I mean `php artisan serve` is not ment for use in production environments because it uses PHP5 build in webserver. Just serve app via Apache or Nginx.
Author
Owner

@CedricGatay commented on GitHub (Dec 16, 2015):

@NamPNQ OK sorry I didn't understand your comment this way. I will have a look but if you have time and the knowledge, a pull request is welcome ;)

<!-- gh-comment-id:165022051 --> @CedricGatay commented on GitHub (Dec 16, 2015): @NamPNQ OK sorry I didn't understand your comment this way. I will have a look but if you have time and the knowledge, a pull request is welcome ;)
Author
Owner

@etopian commented on GitHub (Dec 16, 2015):

https://github.com/etopian/docker-koel

<!-- gh-comment-id:165096094 --> @etopian commented on GitHub (Dec 16, 2015): https://github.com/etopian/docker-koel
Author
Owner

@phanan commented on GitHub (Dec 16, 2015):

@etopian This looks great!

<!-- gh-comment-id:165098033 --> @phanan commented on GitHub (Dec 16, 2015): @etopian This looks great!
Author
Owner

@Cotix commented on GitHub (Dec 17, 2015):

@etopian Why not include the database in the image aswell?

<!-- gh-comment-id:165324527 --> @Cotix commented on GitHub (Dec 17, 2015): @etopian Why not include the database in the image aswell?
Author
Owner

@etopian commented on GitHub (Dec 17, 2015):

@Cotix I run 25 websites on my server. i don't want to run 25 db instances. just use any mysql/mariadb database image. i bind port 3306 to the first IP in Docker's subnet range, 172.17.0.1, so it's accessible to all containers. it's trivial to add an db to the container though, just fork and add it.

<!-- gh-comment-id:165326340 --> @etopian commented on GitHub (Dec 17, 2015): @Cotix I run 25 websites on my server. i don't want to run 25 db instances. just use any mysql/mariadb database image. i bind port 3306 to the first IP in Docker's subnet range, 172.17.0.1, so it's accessible to all containers. it's trivial to add an db to the container though, just fork and add it.
Author
Owner

@SkinyMonkey commented on GitHub (Dec 18, 2015):

@Cotix it's generally a bad practice in docker, if you lose your container you lose your data.

@etopian nice one, why didn't you use a link instead?

<!-- gh-comment-id:165771381 --> @SkinyMonkey commented on GitHub (Dec 18, 2015): @Cotix it's generally a bad practice in docker, if you lose your container you lose your data. @etopian nice one, why didn't you use a link instead?
Author
Owner

@etopian commented on GitHub (Dec 18, 2015):

@SkinyMonkey don't like the concept of strongly coupled things, if you want to upgrade your database how do you do that with 25 sites linked to the db container. docker says you should use an ambassador container, but that just seems like too much complexity. my way of doing it is nice and simple and lets me upgrade the database container anytime i want. i mount the database data dir from the host so that never goes away.

<!-- gh-comment-id:165771870 --> @etopian commented on GitHub (Dec 18, 2015): @SkinyMonkey don't like the concept of strongly coupled things, if you want to upgrade your database how do you do that with 25 sites linked to the db container. docker says you should use an ambassador container, but that just seems like too much complexity. my way of doing it is nice and simple and lets me upgrade the database container anytime i want. i mount the database data dir from the host so that never goes away.
Author
Owner

@SkinyMonkey commented on GitHub (Dec 18, 2015):

Mmh, in this particular context I don't imagine people launching 25 instance of koei but ok ;)

<!-- gh-comment-id:165772065 --> @SkinyMonkey commented on GitHub (Dec 18, 2015): Mmh, in this particular context I don't imagine people launching 25 instance of koei but ok ;)
Author
Owner

@etopian commented on GitHub (Dec 18, 2015):

@SkinyMonkey btw if you want to link a container you can do it with this image.. just specify the link as the DB_HOST... i.e. -v DB_HOST=mysql

<!-- gh-comment-id:165772584 --> @etopian commented on GitHub (Dec 18, 2015): @SkinyMonkey btw if you want to link a container you can do it with this image.. just specify the link as the DB_HOST... i.e. -v DB_HOST=mysql
Author
Owner

@kevincaradant commented on GitHub (Dec 20, 2015):

Hi everyone

Maybe someone will be able to help me about docker. I try to create a docker image for arm support. It's the first time, i look docker so i'm currently learning , i look the etopian Dockerfile and NamPNQ Dockerfile also. For the moment, i stay on Apache and mysql. I want to connect my docker image (koel) with my dokcer image (mysql) . Is it a good practice or not ? .

For my docker koel , this is my first Dockerfile version :

FROM ubuntu:latest
MAINTAINER Kevin CARADANT <caradant@gmail.com>
LABEL   type="web site" \
        architecture="ARMv7"

RUN apt-get update \
    && apt-get install aufs-tools apache2 net-tools apt-utils php5-mysql python dialog php5 g++ git curl automake build-essential bash less vim ca-certificates zlibc zlib1g zlib1g-dev -y \
    && curl -sL https://deb.nodesource.com/setup_5.x | bash - \
    && apt-get install -y nodejs \
    && apt-get clean \
    && npm install -g bower gulp \
    && adduser --gecos '' --disabled-password nginx \
    && chown -R nginx /var/www/html \
    && cd /var/www/html/\

RUN cd /var/www/html/ \
    && su nginx -c 'git config --global url."https://".insteadOf git://' \
    && su nginx -c "git clone https://github.com/phanan/koel \
    && cd koel \
    && npm install"

RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer \
    && cd /var/www/html/koel && composer install

ENV TERM="xterm" \
    DB_HOST="172.17.0.1" \
    DB_DATABASE="koel" \
    DB_USERNAME="koel-db-user"\
    DB_PASSWORD="koel-pass"\
    ADMIN_EMAIL="myadress@gmail.com"\
    ADMIN_NAME="kevin"\
    ADMIN_PASSWORD="kevin"\
    APP_DEBUG=false\
    AP_ENV=production

VOLUME ["/DATA/music"]

RUN rm -rf /var/cache/apt/*
RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /home/nginx/.npm /root/.npm

COPY .env /var/www/html/

RUN a2enmod rewrite
RUN cd /var/www/html/koel && php artisan init
RUN /var/www/html/koel && php artisan serve --host 0.0.0.0

My .env file :

APP_ENV=local
APP_DEBUG=true
APP_KEY=JIOjhioh4iohou7888

# Username and password for the initial admin account
# This info will be populated into the database during `php artisan db:seed`
# After that, it can (and should) be removed from this .env file
ADMIN_EMAIL=$ADMIN_EMAIL
ADMIN_NAME=$ADMIN_NAME
ADMIN_PASSWORD=$ADMIN_PASSWORD

# The maximum scan time, in seconds. Increase this if you have a huge library.
APP_MAX_SCAN_TIME=600

# The streaming method. 
# Can be either 'php' (default), 'x-sendfile', or 'x-accel-redirect'
# See https://github.com/phanan/koel/wiki#streaming-music for more information.
STREAMING_METHOD=php

DB_HOST=$DB_HOST
DB_DATABASE=$DB_DATABASE
DB_USERNAME=$DB_USERNAME
DB_PASSWORD=$DB_PASSWORD

CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync

MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

image
So how to know the IP from mysql:5.6 image ? How to link this database with koel image ?

After my second docker image is just the mysql docker that i have init like this :

sudo docker run -i -t -e MYSQL_ROOT_PASSWORD=my_pass mysql:5.6

docker exec -it 360b4e5b246f bash

and write this :
mysql> CREATE DATABASE koel DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;

mysql>CREATE USER 'koel-db-user'@'localhost' IDENTIFIED BY 'koel-pass';

mysql> GRANT ALL PRIVILEGES ON koel.* TO 'koel-db-user'@'localhost' WITH GRANT OPTION;

PS: In this case i used an image no arm because i lost all my last day to build just 4 times, that ask so much time and RAM ... so when it's good with intel64bits , i will adapt for my arm version :).

Thank you for your help guys, i know it's not your first task in your list but that will be very nice for me ;)

<!-- gh-comment-id:166115012 --> @kevincaradant commented on GitHub (Dec 20, 2015): Hi everyone Maybe someone will be able to help me about docker. I try to create a docker image for arm support. It's the first time, i look docker so i'm currently learning , i look the etopian Dockerfile and NamPNQ Dockerfile also. For the moment, i stay on Apache and mysql. I want to connect my docker image (koel) with my dokcer image (mysql) . Is it a good practice or not ? . For my docker koel , this is my first Dockerfile version : ``` FROM ubuntu:latest MAINTAINER Kevin CARADANT <caradant@gmail.com> LABEL type="web site" \ architecture="ARMv7" RUN apt-get update \ && apt-get install aufs-tools apache2 net-tools apt-utils php5-mysql python dialog php5 g++ git curl automake build-essential bash less vim ca-certificates zlibc zlib1g zlib1g-dev -y \ && curl -sL https://deb.nodesource.com/setup_5.x | bash - \ && apt-get install -y nodejs \ && apt-get clean \ && npm install -g bower gulp \ && adduser --gecos '' --disabled-password nginx \ && chown -R nginx /var/www/html \ && cd /var/www/html/\ RUN cd /var/www/html/ \ && su nginx -c 'git config --global url."https://".insteadOf git://' \ && su nginx -c "git clone https://github.com/phanan/koel \ && cd koel \ && npm install" RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer \ && cd /var/www/html/koel && composer install ENV TERM="xterm" \ DB_HOST="172.17.0.1" \ DB_DATABASE="koel" \ DB_USERNAME="koel-db-user"\ DB_PASSWORD="koel-pass"\ ADMIN_EMAIL="myadress@gmail.com"\ ADMIN_NAME="kevin"\ ADMIN_PASSWORD="kevin"\ APP_DEBUG=false\ AP_ENV=production VOLUME ["/DATA/music"] RUN rm -rf /var/cache/apt/* RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /home/nginx/.npm /root/.npm COPY .env /var/www/html/ RUN a2enmod rewrite RUN cd /var/www/html/koel && php artisan init RUN /var/www/html/koel && php artisan serve --host 0.0.0.0 ``` My .env file : ``` APP_ENV=local APP_DEBUG=true APP_KEY=JIOjhioh4iohou7888 # Username and password for the initial admin account # This info will be populated into the database during `php artisan db:seed` # After that, it can (and should) be removed from this .env file ADMIN_EMAIL=$ADMIN_EMAIL ADMIN_NAME=$ADMIN_NAME ADMIN_PASSWORD=$ADMIN_PASSWORD # The maximum scan time, in seconds. Increase this if you have a huge library. APP_MAX_SCAN_TIME=600 # The streaming method. # Can be either 'php' (default), 'x-sendfile', or 'x-accel-redirect' # See https://github.com/phanan/koel/wiki#streaming-music for more information. STREAMING_METHOD=php DB_HOST=$DB_HOST DB_DATABASE=$DB_DATABASE DB_USERNAME=$DB_USERNAME DB_PASSWORD=$DB_PASSWORD CACHE_DRIVER=file SESSION_DRIVER=file QUEUE_DRIVER=sync MAIL_DRIVER=smtp MAIL_HOST=mailtrap.io MAIL_PORT=2525 MAIL_USERNAME=null MAIL_PASSWORD=null MAIL_ENCRYPTION=null ``` ![image](https://cloud.githubusercontent.com/assets/6093175/11918178/1aff9ae0-a727-11e5-841b-37bd84c81f42.png) So how to know the IP from mysql:5.6 image ? How to link this database with koel image ? After my second docker image is just the mysql docker that i have init like this : `sudo docker run -i -t -e MYSQL_ROOT_PASSWORD=my_pass mysql:5.6` `docker exec -it 360b4e5b246f bash` and write this : `mysql> CREATE DATABASE koel DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;` `mysql>CREATE USER 'koel-db-user'@'localhost' IDENTIFIED BY 'koel-pass';` `mysql> GRANT ALL PRIVILEGES ON koel.* TO 'koel-db-user'@'localhost' WITH GRANT OPTION;` PS: In this case i used an image no arm because i lost all my last day to build just 4 times, that ask so much time and RAM ... so when it's good with intel64bits , i will adapt for my arm version :). Thank you for your help guys, i know it's not your first task in your list but that will be very nice for me ;)
Author
Owner

@CedricGatay commented on GitHub (Dec 20, 2015):

@kevincaradant Hi,
I think your image contains unnecessary things (nginx/apache but you're running it with php).
For a x86 working image, take a look at my repository (https://github.com/CedricGatay/docker-koel) and use the docker-compose file to be up and running.
But as you're running under arm, I guess you will need to change the FROM for my dockerfile as well as pick a mysql/mariadb compatible image.

<!-- gh-comment-id:166117848 --> @CedricGatay commented on GitHub (Dec 20, 2015): @kevincaradant Hi, I think your image contains unnecessary things (nginx/apache but you're running it with php). For a x86 working image, take a look at my repository (https://github.com/CedricGatay/docker-koel) and use the docker-compose file to be up and running. But as you're running under arm, I guess you will need to change the FROM for my dockerfile as well as pick a mysql/mariadb compatible image.
Author
Owner

@kevincaradant commented on GitHub (Dec 20, 2015):

Thank you @CedricGatay , i like your repo simple. It's very interesting.

So i replace that :

RUN apt-get update \ && apt-get install aufs-tools apache2 net-tools apt-utils php5-mysql python dialog php5 g++ git curl automake build-essential bash less vim ca-certificates zlibc zlib1g zlib1g-dev -y \

By that :

RUN apt-get update \ && apt-get -y -q install aufs-tools net-tools apt-utils python bash g++ git curl automake php5 dialog php5-cli php5-mysql git curl build-essential\

I deleted apache and user nginx.
My new Dockerfile very silimar with yours ^^ :

FROM ubuntu:latest
MAINTAINER Kevin CARADANT <kevin.caradant@gmail.com>

LABEL   type="Site Web" \
        architecture="ARMv7"

RUN apt-get update \
    && apt-get install aufs-tools net-tools apt-utils python bash g++ git curl automake php5 php5-cli php5-mysql git curl build-essential -y \
    && curl -sL https://deb.nodesource.com/setup_5.x | bash - \
    && apt-get install -y nodejs \
    && curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
    && apt-get clean \
    && npm install -g bower gulp \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

RUN groupadd -r koel -g 1000 \
    && useradd -u 1000 -r -g koel -d /app -s /sbin/nologin -c "Docker image user" koel\ 
    && mkdir -p /app \
    && chown -R koel:koel /app

EXPOSE 8000

USER koel

WORKDIR /app

RUN git config --global url."https://".insteadOf git:// \
    &&  git clone https://github.com/phanan/koel \
    && cd koel \
    && composer install

WORKDIR /app/koel

VOLUME ["/DATA/music"]


COPY env .env
COPY run.sh run.sh

RUN rm -rf /var/cache/apt/*
RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /home/nginx/.npm /root/.npm

USER root
RUN chown -R koel:koel /app

USER koel
CMD ["/app/koel/run.sh"] 

After i see, you use something that i didn't understand before "docker-compose" .

I get yours but in "links" you have db:db . What is it ? i replace by what ?

After if i understand, i have to realize this :

docker build -i -t my_koel_arm .
that execute my Dockerfile that i defined

Then :

docker-compose up -d db; sleep 60; docker-compose up -d app; i don't understand option and what replace. what is the flag "-d" , i didn't see in the document docker-compose. :/. is it this , which link mysql image with koel image ?

Thank you for all after that , a lot of things will be more clear for me :D

<!-- gh-comment-id:166124229 --> @kevincaradant commented on GitHub (Dec 20, 2015): Thank you @CedricGatay , i like your repo simple. It's very interesting. So i replace that : `RUN apt-get update \ && apt-get install aufs-tools apache2 net-tools apt-utils php5-mysql python dialog php5 g++ git curl automake build-essential bash less vim ca-certificates zlibc zlib1g zlib1g-dev -y \` By that : `RUN apt-get update \ && apt-get -y -q install aufs-tools net-tools apt-utils python bash g++ git curl automake php5 dialog php5-cli php5-mysql git curl build-essential\` I deleted apache and user nginx. My new Dockerfile very silimar with yours ^^ : ``` FROM ubuntu:latest MAINTAINER Kevin CARADANT <kevin.caradant@gmail.com> LABEL type="Site Web" \ architecture="ARMv7" RUN apt-get update \ && apt-get install aufs-tools net-tools apt-utils python bash g++ git curl automake php5 php5-cli php5-mysql git curl build-essential -y \ && curl -sL https://deb.nodesource.com/setup_5.x | bash - \ && apt-get install -y nodejs \ && curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \ && apt-get clean \ && npm install -g bower gulp \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* RUN groupadd -r koel -g 1000 \ && useradd -u 1000 -r -g koel -d /app -s /sbin/nologin -c "Docker image user" koel\ && mkdir -p /app \ && chown -R koel:koel /app EXPOSE 8000 USER koel WORKDIR /app RUN git config --global url."https://".insteadOf git:// \ && git clone https://github.com/phanan/koel \ && cd koel \ && composer install WORKDIR /app/koel VOLUME ["/DATA/music"] COPY env .env COPY run.sh run.sh RUN rm -rf /var/cache/apt/* RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /home/nginx/.npm /root/.npm USER root RUN chown -R koel:koel /app USER koel CMD ["/app/koel/run.sh"] ``` After i see, you use something that i didn't understand before "docker-compose" . I get yours but in "links" you have db:db . What is it ? i replace by what ? After if i understand, i have to realize this : `docker build -i -t my_koel_arm .` that execute my Dockerfile that i defined Then : `docker-compose up -d db; sleep 60; docker-compose up -d app;` i don't understand option and what replace. what is the flag "-d" , i didn't see in the document docker-compose. :/. is it this , which link mysql image with koel image ? Thank you for all after that , a lot of things will be more clear for me :D
Author
Owner

@CedricGatay commented on GitHub (Dec 20, 2015):

@kevincaradant I think you need to read more of docker documentation. In fact the docker link feature is used to link container. My db:db line does the link automatically between my db service (_:db) as a db host (db:_) when my app container is ran.

With compose you don't need to run your docker file manually, but you only have to run via compose (the -d flag makes the container go to the background).

To use the repository I gave you, you only need to symlink your music to the proper folder and everything should be working (perhaps some improvements are possible by using apache or nginx instead of php though)

<!-- gh-comment-id:166124464 --> @CedricGatay commented on GitHub (Dec 20, 2015): @kevincaradant I think you need to read more of docker documentation. In fact the docker link feature is used to link container. My `db:db` line does the link automatically between my `db` service (`_:db`) as a `db` host (`db:_`) when my `app` container is ran. With compose you don't need to run your docker file manually, but you only have to run via compose (the `-d` flag makes the container go to the background). To use the repository I gave you, you only need to symlink your music to the proper folder and everything should be working (perhaps some improvements are possible by using apache or nginx instead of php though)
Author
Owner

@kevincaradant commented on GitHub (Dec 20, 2015):

ohh oki thank you for this information , i'm going to learn more about this subject, , i ask you, just a last question; I'm trying to use your repo . But i get this question with your command (maybe i'm stupid but i think, you don't give me the solution about this ) :

docker-compose up -d db; sleep 60; docker-compose up -d app; 

image

What need to mention ? Thank you

Edit : it was just a problem of rights ... sudo fix it.... sorry for this useless question

<!-- gh-comment-id:166133111 --> @kevincaradant commented on GitHub (Dec 20, 2015): ohh oki thank you for this information , i'm going to learn more about this subject, , i ask you, just a last question; I'm trying to use your repo . But i get this question with your command (maybe i'm stupid but i think, you don't give me the solution about this ) : ``` docker-compose up -d db; sleep 60; docker-compose up -d app; ``` ![image](https://cloud.githubusercontent.com/assets/6093175/11918705/beb47dbc-a73c-11e5-8fef-d3c6acd6c9ef.png) What need to mention ? Thank you Edit : it was just a problem of rights ... sudo fix it.... sorry for this useless question
Author
Owner

@CedricGatay commented on GitHub (Dec 20, 2015):

@kevincaradant add your user to the docker group (sudo usermod -aG docker $(whoami)) to get rid of sudoing every docker command.

I updated my docker image to use php7 with apache2 (cc @phanan). Feel free to take a look at it.

<!-- gh-comment-id:166153146 --> @CedricGatay commented on GitHub (Dec 20, 2015): @kevincaradant add your user to the docker group (`sudo usermod -aG docker $(whoami)`) to get rid of sudoing every docker command. I updated my docker image to use php7 with apache2 (cc @phanan). Feel free to take a look at it.
Author
Owner

@kevincaradant commented on GitHub (Dec 20, 2015):

yep i watch your repo very often, i see your update but i was still to understand your first commit :) , i will check that tomorrow now i know the base of docker. Thank you @CedricGatay :) and ok for the command about rights ;)

<!-- gh-comment-id:166160100 --> @kevincaradant commented on GitHub (Dec 20, 2015): yep i watch your repo very often, i see your update but i was still to understand your first commit :) , i will check that tomorrow now i know the base of docker. Thank you @CedricGatay :) and ok for the command about rights ;)
Author
Owner

@jommgoncalves commented on GitHub (Dec 23, 2015):

+1

For now, I only want test it. The list of dependencies is incredible!

<!-- gh-comment-id:166978424 --> @jommgoncalves commented on GitHub (Dec 23, 2015): +1 For now, I only want test it. The list of dependencies is incredible!
Author
Owner

@kevincaradant commented on GitHub (Dec 24, 2015):

i think i'm not so far to success, but in the moment that does not work... this is my repo inspired by existing repo on docker : https://github.com/kevincaradant/armhf_docker_koel/tree/dev , even the readme is not changed ^^, . It's for intel but i can easily trnsform it for arm that why i like my repo. If someone can help me about config because i get this error in : /DATA/htdocs/storage/logs/laravel.log

[2015-12-24 02:36:11] local.ERROR: exception 'PDOException' with message 'SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)' in /DATA/htdocs/vendor/laravel/framework/src/Il$
Stack trace:
#0 /DATA/htdocs/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(55): PDO->__construct('mysql:host=;dbn...', '', '', Array)
#1 /DATA/htdocs/vendor/laravel/framework/src/Illuminate/Database/Connectors/MySqlConnector.php(22): Illuminate\Database\Connectors\Connector->createConnection('mysql:host=;dbn...', Array, Array)
#2 /DATA/htdocs/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectionFactory.php(60): Illuminate\Database\Connectors\MySqlConnector->connect(Array)
#3 /

i don't know what can i change . But when i see that : mysql:host=;dbn that seem let to think that the variables are unknown inside the docker no ? thank you very much :) and sorry to invade the thread with my problem ;)

<!-- gh-comment-id:167119867 --> @kevincaradant commented on GitHub (Dec 24, 2015): i think i'm not so far to success, but in the moment that does not work... this is my repo inspired by existing repo on docker : https://github.com/kevincaradant/armhf_docker_koel/tree/dev , even the readme is not changed ^^, . It's for intel but i can easily trnsform it for arm that why i like my repo. If someone can help me about config because i get this error in : /DATA/htdocs/storage/logs/laravel.log ``` [2015-12-24 02:36:11] local.ERROR: exception 'PDOException' with message 'SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)' in /DATA/htdocs/vendor/laravel/framework/src/Il$ Stack trace: #0 /DATA/htdocs/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(55): PDO->__construct('mysql:host=;dbn...', '', '', Array) #1 /DATA/htdocs/vendor/laravel/framework/src/Illuminate/Database/Connectors/MySqlConnector.php(22): Illuminate\Database\Connectors\Connector->createConnection('mysql:host=;dbn...', Array, Array) #2 /DATA/htdocs/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectionFactory.php(60): Illuminate\Database\Connectors\MySqlConnector->connect(Array) #3 / ``` i don't know what can i change . But when i see that : `mysql:host=;dbn` that seem let to think that the variables are unknown inside the docker no ? thank you very much :) and sorry to invade the thread with my problem ;)
Author
Owner

@Qeole commented on GitHub (Jan 17, 2016):

Hi there!
Just in case it could help someone, I run @etopian's koel Docker image and wrote a tutorial on the steps I executed to make it work. Available there: https://blog.qoba.lt/koel_with_docker.html

<!-- gh-comment-id:172386779 --> @Qeole commented on GitHub (Jan 17, 2016): Hi there! Just in case it could help someone, I run @etopian's koel Docker image and wrote a tutorial on the steps I executed to make it work. Available there: https://blog.qoba.lt/koel_with_docker.html
Author
Owner

@jee-r commented on GitHub (Jan 18, 2016):

Thx @Qeole for this tuto, Thx @phanan for koel and @etopian for the dockerfile.

What about the lastfm feature ? is this in the todo-list

<!-- gh-comment-id:172399856 --> @jee-r commented on GitHub (Jan 18, 2016): Thx @Qeole for this tuto, Thx @phanan for koel and @etopian for the dockerfile. What about the lastfm feature ? is this in the todo-list
Author
Owner

@etopian commented on GitHub (Jan 18, 2016):

@Qeole your page has been referenced by my Docker image. Thanks for the writeup.

<!-- gh-comment-id:172399917 --> @etopian commented on GitHub (Jan 18, 2016): @Qeole your page has been referenced by my Docker image. Thanks for the writeup.
Author
Owner

@NamPNQ commented on GitHub (Jan 18, 2016):

@Qeole try using docker compose for simple setup :D

<!-- gh-comment-id:172416938 --> @NamPNQ commented on GitHub (Jan 18, 2016): @Qeole try using docker compose for simple setup :D
Author
Owner

@Qeole commented on GitHub (Jan 18, 2016):

@NamPNQ Thanks, I'll have a look at it!
@etopian that's neat! Thanks

<!-- gh-comment-id:172633265 --> @Qeole commented on GitHub (Jan 18, 2016): @NamPNQ Thanks, I'll have a look at it! @etopian that's neat! Thanks
Author
Owner

@phanan commented on GitHub (Jan 31, 2016):

I guess any of you can come up with a custom docker now, no need for an "official" kind of. Closing this to clean the list.

<!-- gh-comment-id:177512320 --> @phanan commented on GitHub (Jan 31, 2016): I guess any of you can come up with a custom docker now, no need for an "official" kind of. Closing this to clean the list.
Author
Owner

@maxengel commented on GitHub (Jul 16, 2017):

@etopian Thanks for creating this! Everything goes fine, but upon first run, the media path in "Settings" is empty, despite setting it when getting the container setup. I can change it to /DATA/music and can confirm via the CLI that it sees the music, but scanning doesn't seem to work. Any ideas?

<!-- gh-comment-id:315646833 --> @maxengel commented on GitHub (Jul 16, 2017): @etopian Thanks for creating this! Everything goes fine, but upon first run, the media path in "Settings" is empty, despite setting it when getting the container setup. I can change it to /DATA/music and can confirm via the CLI that it sees the music, but scanning doesn't seem to work. Any ideas?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/koel-koel#8
No description provided.