From 7f4e411d3d4ab838352b1e94158da3eeb55fac71 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Sat, 14 May 2016 04:20:20 +0300 Subject: [PATCH 01/53] link containers to PHP --- docker-compose.yml | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index c47c6196..af36bcef 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -91,6 +91,19 @@ services: - data ports: - "6379:6379" + links: + - php + +### Memcached Container ##################################### + + memcached: + build: ./memcached + volumes_from: + - data + ports: + - "11211:11211" + links: + - php ### Beanstalkd Container #################################### @@ -99,6 +112,8 @@ services: ports: - "11300:11300" privileged: true + links: + - php ### Beanstalkd-Console Container ############################ @@ -109,13 +124,4 @@ services: links: - beanstalkd -### Memcached Container ######################################### - - memcached: - build: ./memcached - volumes_from: - - data - ports: - - "11211:11211" - ### Add more Containers below ############################### From 405067d4afaf8d0c62ced33d3716ba98cd101ed0 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Sat, 14 May 2016 04:50:47 +0300 Subject: [PATCH 02/53] Separate the PHP versions to multiple dockerfiles Because there's some difference in installing some libraries between PHP 5 and PHP 7. There must be multiple php dockerfiles. For that I created 3 docker files each of a different version, this will make it easy for the users to switch between the PHP version by just editing the docker-compose file and not touching the dockerfiles. --- README.md | 26 +++++++++++++++++--------- docker-compose.yml | 4 +++- php/Dockerfile-php-55 | 23 +++++++++++++++++++++++ php/Dockerfile-php-56 | 23 +++++++++++++++++++++++ php/{Dockerfile => Dockerfile-php-70} | 3 +-- 5 files changed, 67 insertions(+), 12 deletions(-) create mode 100644 php/Dockerfile-php-55 create mode 100644 php/Dockerfile-php-56 rename php/{Dockerfile => Dockerfile-php-70} (84%) diff --git a/README.md b/README.md index 358beee3..c8c4e620 100644 --- a/README.md +++ b/README.md @@ -282,29 +282,37 @@ By default **PHP 7.0** is running.
To change the default PHP version: -1 - Open the `dockerfile` of the `php` folder. +1 - Open the `docker-compose.yml`. -2 - Change the PHP version number in the first line, +2 - Search for `Dockerfile-php-70` in the PHP container section. + +3 - Change the version number. +
+Example to select version 5.6 instead of 7.0 you have to replace `Dockerfile-php-70` with `Dockerfile-php-56`. + +Sample: ```txt -FROM php:7.0-fpm +php: + build: + context: ./php + dockerfile: Dockerfile-php-70 ``` Supported Versions: -- For (PHP 7.0.*) use `php:7.0-fpm` -- For (PHP 5.6.*) use `php:5.6-fpm` -- For (PHP 5.5.*) use `php:5.5-fpm` +- For (PHP 7.0.*) use `Dockerfile-php-70` +- For (PHP 5.6.*) use `Dockerfile-php-56` +- For (PHP 5.5.*) use `Dockerfile-php-55` -For more details visit the [official PHP docker images](https://hub.docker.com/_/php/). -3 - Finally rebuild the container +4 - Finally rebuild the container ```bash docker-compose build php ``` - +For more details visit the [official PHP docker images](https://hub.docker.com/_/php/).
diff --git a/docker-compose.yml b/docker-compose.yml index af36bcef..549458d1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,7 +18,9 @@ services: ### PHP Container ########################################### php: - build: ./php + build: + context: ./php + dockerfile: Dockerfile-php-70 volumes: - ../:/var/www/laravel - ./logs/php/:/usr/local/var/log diff --git a/php/Dockerfile-php-55 b/php/Dockerfile-php-55 new file mode 100644 index 00000000..b8f69b2d --- /dev/null +++ b/php/Dockerfile-php-55 @@ -0,0 +1,23 @@ +FROM php:5.5-fpm + +MAINTAINER Mahmoud Zalt + +ADD ./laravel.ini /usr/local/etc/php/conf.d +ADD ./laravel.pool.conf /usr/local/etc/php-fpm.d/ + +RUN apt-get update && apt-get install \ + libpq-dev -y \ + curl + +# Install extensions using the helper script provided by the base image +RUN docker-php-ext-install \ + pdo_mysql \ + pdo_pgsql + +RUN usermod -u 1000 www-data + +WORKDIR /var/www/laravel + +CMD ["php-fpm"] + +EXPOSE 9000 diff --git a/php/Dockerfile-php-56 b/php/Dockerfile-php-56 new file mode 100644 index 00000000..b43fe415 --- /dev/null +++ b/php/Dockerfile-php-56 @@ -0,0 +1,23 @@ +FROM php:5.6-fpm + +MAINTAINER Mahmoud Zalt + +ADD ./laravel.ini /usr/local/etc/php/conf.d +ADD ./laravel.pool.conf /usr/local/etc/php-fpm.d/ + +RUN apt-get update && apt-get install \ + libpq-dev -y \ + curl + +# Install extensions using the helper script provided by the base image +RUN docker-php-ext-install \ + pdo_mysql \ + pdo_pgsql + +RUN usermod -u 1000 www-data + +WORKDIR /var/www/laravel + +CMD ["php-fpm"] + +EXPOSE 9000 diff --git a/php/Dockerfile b/php/Dockerfile-php-70 similarity index 84% rename from php/Dockerfile rename to php/Dockerfile-php-70 index 0f9635c8..e6b34160 100644 --- a/php/Dockerfile +++ b/php/Dockerfile-php-70 @@ -1,5 +1,4 @@ -# You can change the PHP version from here. After changing the PHP version, check the Memcached section below because it replies on PHP 7. -FROM php:7.0-fpm +FROM php:7.0-fpm MAINTAINER Mahmoud Zalt From fdba7e7c09b7829077bf260dca24fbbe748e4105 Mon Sep 17 00:00:00 2001 From: matt Date: Sat, 14 May 2016 17:21:36 +0100 Subject: [PATCH 03/53] add memcached support for PHP 5.5 & 5.6 --- php/Dockerfile-php-55 | 5 +++++ php/Dockerfile-php-56 | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/php/Dockerfile-php-55 b/php/Dockerfile-php-55 index b8f69b2d..4c2a7732 100644 --- a/php/Dockerfile-php-55 +++ b/php/Dockerfile-php-55 @@ -7,6 +7,7 @@ ADD ./laravel.pool.conf /usr/local/etc/php-fpm.d/ RUN apt-get update && apt-get install \ libpq-dev -y \ + libmemcached-dev \ curl # Install extensions using the helper script provided by the base image @@ -14,6 +15,10 @@ RUN docker-php-ext-install \ pdo_mysql \ pdo_pgsql +#Install memcached +RUN pecl install memcached \ + && docker-php-ext-enable memcached + RUN usermod -u 1000 www-data WORKDIR /var/www/laravel diff --git a/php/Dockerfile-php-56 b/php/Dockerfile-php-56 index b43fe415..baa26a7c 100644 --- a/php/Dockerfile-php-56 +++ b/php/Dockerfile-php-56 @@ -7,6 +7,7 @@ ADD ./laravel.pool.conf /usr/local/etc/php-fpm.d/ RUN apt-get update && apt-get install \ libpq-dev -y \ + libmemcached-dev \ curl # Install extensions using the helper script provided by the base image @@ -14,6 +15,10 @@ RUN docker-php-ext-install \ pdo_mysql \ pdo_pgsql +#Install memcached +RUN pecl install memcached \ + && docker-php-ext-enable memcached + RUN usermod -u 1000 www-data WORKDIR /var/www/laravel From 84f766363d7b37a56202494b05b8cdfb777bde48 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Tue, 17 May 2016 10:50:51 +0800 Subject: [PATCH 04/53] Replace docker-compose rm with down command. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c8c4e620..af7c9f04 100644 --- a/README.md +++ b/README.md @@ -249,7 +249,7 @@ docker-compose stop {container-name} #### Delete all existing Containers ```bash -docker-compose rm -f +docker-compose down ``` *Note: Careful with this command as it will delete your Data Volume Container as well. (if you want to keep your Database data than you should stop each container by itself as follow):* @@ -551,4 +551,4 @@ If you have any question, send me a direct message on LaraChat, my username is ` ## License [MIT License (MIT)](https://github.com/laradock/laradock/blob/master/LICENSE) -[]([]()) \ No newline at end of file +[]([]()) From 36b49f5ae2d37d8f83225c7e4ee670ca736e01dd Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Tue, 17 May 2016 23:47:26 +0300 Subject: [PATCH 05/53] formatting and small updates --- README.md | 4 ++-- php/Dockerfile-php-55 | 4 ++-- php/Dockerfile-php-56 | 4 ++-- php/Dockerfile-php-70 | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index af7c9f04..15f9d5ae 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ It contains pre-packaged Docker Images that provides you a wonderful development **Usage Overview:** Run `NGINX`, `MySQL` and `Redis`. ```shell -docker-compose up -d nginx mysql redis +docker-compose up nginx mysql redis ``` @@ -89,7 +89,7 @@ docker-compose up -d nginx mysql redis - Beanstalkd Console - Data Volume ->Cannot find your container! we would love to have it as well. Consider contributing your container and adding it to this list. +>If you can't find your container, build it yourself and add it to this list. Contributions are welcomed :) diff --git a/php/Dockerfile-php-55 b/php/Dockerfile-php-55 index 4c2a7732..93d82c52 100644 --- a/php/Dockerfile-php-55 +++ b/php/Dockerfile-php-55 @@ -5,8 +5,8 @@ MAINTAINER Mahmoud Zalt ADD ./laravel.ini /usr/local/etc/php/conf.d ADD ./laravel.pool.conf /usr/local/etc/php-fpm.d/ -RUN apt-get update && apt-get install \ - libpq-dev -y \ +RUN apt-get update && apt-get install -y \ + libpq-dev \ libmemcached-dev \ curl diff --git a/php/Dockerfile-php-56 b/php/Dockerfile-php-56 index baa26a7c..5da34488 100644 --- a/php/Dockerfile-php-56 +++ b/php/Dockerfile-php-56 @@ -5,8 +5,8 @@ MAINTAINER Mahmoud Zalt ADD ./laravel.ini /usr/local/etc/php/conf.d ADD ./laravel.pool.conf /usr/local/etc/php-fpm.d/ -RUN apt-get update && apt-get install \ - libpq-dev -y \ +RUN apt-get update && apt-get install -y \ + libpq-dev \ libmemcached-dev \ curl diff --git a/php/Dockerfile-php-70 b/php/Dockerfile-php-70 index e6b34160..61f21d07 100644 --- a/php/Dockerfile-php-70 +++ b/php/Dockerfile-php-70 @@ -5,10 +5,10 @@ MAINTAINER Mahmoud Zalt ADD ./laravel.ini /usr/local/etc/php/conf.d ADD ./laravel.pool.conf /usr/local/etc/php-fpm.d/ -RUN apt-get update && apt-get install \ - libpq-dev -y \ - curl \ - libmemcached-dev +RUN apt-get update && apt-get install -y \ + libpq-dev \ + libmemcached-dev \ + curl # Install extensions using the helper script provided by the base image RUN docker-php-ext-install \ From 4edf9418720494096e010d0d09f81482f2e173bf Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Wed, 18 May 2016 02:43:23 +0300 Subject: [PATCH 06/53] rename php to php-fpm preparing to add php cli as part of the workspace container --- docker-compose.yml | 8 ++++---- php/Dockerfile-php-55 => php-fpm/Dockerfile-55 | 0 php/Dockerfile-php-56 => php-fpm/Dockerfile-56 | 0 php/Dockerfile-php-70 => php-fpm/Dockerfile-70 | 0 {php => php-fpm}/laravel.ini | 0 {php => php-fpm}/laravel.pool.conf | 0 6 files changed, 4 insertions(+), 4 deletions(-) rename php/Dockerfile-php-55 => php-fpm/Dockerfile-55 (100%) rename php/Dockerfile-php-56 => php-fpm/Dockerfile-56 (100%) rename php/Dockerfile-php-70 => php-fpm/Dockerfile-70 (100%) rename {php => php-fpm}/laravel.ini (100%) rename {php => php-fpm}/laravel.pool.conf (100%) diff --git a/docker-compose.yml b/docker-compose.yml index 549458d1..50cb5e21 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,12 +15,12 @@ services: links: - php -### PHP Container ########################################### +### PHP-FPM Container ####################################### - php: + php-fpm: build: - context: ./php - dockerfile: Dockerfile-php-70 + context: ./php-fpm + dockerfile: Dockerfile-70 volumes: - ../:/var/www/laravel - ./logs/php/:/usr/local/var/log diff --git a/php/Dockerfile-php-55 b/php-fpm/Dockerfile-55 similarity index 100% rename from php/Dockerfile-php-55 rename to php-fpm/Dockerfile-55 diff --git a/php/Dockerfile-php-56 b/php-fpm/Dockerfile-56 similarity index 100% rename from php/Dockerfile-php-56 rename to php-fpm/Dockerfile-56 diff --git a/php/Dockerfile-php-70 b/php-fpm/Dockerfile-70 similarity index 100% rename from php/Dockerfile-php-70 rename to php-fpm/Dockerfile-70 diff --git a/php/laravel.ini b/php-fpm/laravel.ini similarity index 100% rename from php/laravel.ini rename to php-fpm/laravel.ini diff --git a/php/laravel.pool.conf b/php-fpm/laravel.pool.conf similarity index 100% rename from php/laravel.pool.conf rename to php-fpm/laravel.pool.conf From 504c9c59d56f5c413b41f91bd6b1d238ed1d4f6b Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Wed, 18 May 2016 02:46:27 +0300 Subject: [PATCH 07/53] Create workspace container the workspace container is based from Ubuntu 16.04 it includes PHP-CLI 7 - Git - cURL and Vim for now --- docker-compose.yml | 7 ++++++ workspace/Dockerfile | 51 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 workspace/Dockerfile diff --git a/docker-compose.yml b/docker-compose.yml index 50cb5e21..5339783f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -126,4 +126,11 @@ services: links: - beanstalkd +### Workspace Container ##################################### + + workspace: + build: ./workspace + volumes_from: + - data + ### Add more Containers below ############################### diff --git a/workspace/Dockerfile b/workspace/Dockerfile new file mode 100644 index 00000000..c764aa0c --- /dev/null +++ b/workspace/Dockerfile @@ -0,0 +1,51 @@ +FROM ubuntu:16.04 + +MAINTAINER Mahmoud Zalt + +RUN DEBIAN_FRONTEND=noninteractive +RUN locale-gen en_US.UTF-8 +ENV LANGUAGE=en_US.UTF-8 +ENV LANG=en_US.UTF-8 +ENV LC_ALL=en_US.UTF-8 + +# Install some essential libraries +RUN apt-get update && apt-get install -y \ + software-properties-common \ + python-software-properties \ + autoconf \ + file \ + g++ \ + gcc \ + libc-dev \ + make \ + pkg-config + +# Install PHP-CLI 7 +RUN add-apt-repository -y ppa:ondrej/php +RUN apt-get update && apt-get install -y \ + php7.0-cli \ + php7.0-common \ + php7.0-curl \ + php7.0-json \ + php7.0-mbstring \ + php7.0-mcrypt \ + php7.0-mysql + +# Install some Tools +RUN apt-get install -y \ + git \ + curl \ + vim + +# Setup the Composer installer +RUN curl -s http://getcomposer.org/installer | php \ + && mv composer.phar /usr/local/bin/ \ + && alias composer='/usr/local/bin/composer.phar' + +# Clean up +RUN rm -r /var/lib/apt/lists/* + +ENTRYPOINT ["top", "-b"] + +WORKDIR /var/www/laravel + From efd062fd882702fe31d641033aafcae95574553a Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Wed, 18 May 2016 02:54:23 +0300 Subject: [PATCH 08/53] fix linking containers to php-fpm instead of php --- docker-compose.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 5339783f..bd8d26cf 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,13 +7,13 @@ services: nginx: build: ./nginx volumes_from: - - php + - php-fpm volumes: - ./logs/nginx/:/var/log/nginx ports: - "80:80" links: - - php + - php-fpm ### PHP-FPM Container ####################################### @@ -52,7 +52,7 @@ services: MYSQL_PASSWORD: secret MYSQL_ROOT_PASSWORD: root links: - - php + - php-fpm ### PostgreSQL Container #################################### @@ -67,7 +67,7 @@ services: POSTGRES_USER: homestead POSTGRES_PASSWORD: secret links: - - php + - php-fpm ### MariaDB Container ####################################### @@ -83,7 +83,7 @@ services: MYSQL_PASSWORD: secret MYSQL_ROOT_PASSWORD: root links: - - php + - php-fpm ### Redis Container ######################################### @@ -94,7 +94,7 @@ services: ports: - "6379:6379" links: - - php + - php-fpm ### Memcached Container ##################################### @@ -105,7 +105,7 @@ services: ports: - "11211:11211" links: - - php + - php-fpm ### Beanstalkd Container #################################### @@ -115,7 +115,7 @@ services: - "11300:11300" privileged: true links: - - php + - php-fpm ### Beanstalkd-Console Container ############################ From 7dcf481d21b709d00b601cfb0ffff09fc2d299c8 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Wed, 18 May 2016 02:54:35 +0300 Subject: [PATCH 09/53] install nano in the workspace container --- workspace/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/workspace/Dockerfile b/workspace/Dockerfile index c764aa0c..077e7a92 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -35,7 +35,8 @@ RUN apt-get update && apt-get install -y \ RUN apt-get install -y \ git \ curl \ - vim + vim \ + nano # Setup the Composer installer RUN curl -s http://getcomposer.org/installer | php \ From 97500508f51107bd80577964c2ebd2a2b8b5e07f Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Wed, 18 May 2016 03:54:21 +0300 Subject: [PATCH 10/53] reformat the workspace Dockerfile --- workspace/Dockerfile | 50 +++++++++++++++++++------------------------- 1 file changed, 21 insertions(+), 29 deletions(-) diff --git a/workspace/Dockerfile b/workspace/Dockerfile index 077e7a92..d7de228f 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -4,41 +4,33 @@ MAINTAINER Mahmoud Zalt RUN DEBIAN_FRONTEND=noninteractive RUN locale-gen en_US.UTF-8 + ENV LANGUAGE=en_US.UTF-8 ENV LANG=en_US.UTF-8 ENV LC_ALL=en_US.UTF-8 +ENV TERM xterm -# Install some essential libraries -RUN apt-get update && apt-get install -y \ - software-properties-common \ - python-software-properties \ - autoconf \ - file \ - g++ \ - gcc \ - libc-dev \ - make \ - pkg-config +# Install "software-properties-common" (for add-apt-repository) and add the "PHP 7" ppa +RUN apt-get update \ + && apt-get install -y software-properties-common \ + && add-apt-repository -y ppa:ondrej/php -# Install PHP-CLI 7 -RUN add-apt-repository -y ppa:ondrej/php -RUN apt-get update && apt-get install -y \ - php7.0-cli \ - php7.0-common \ - php7.0-curl \ - php7.0-json \ - php7.0-mbstring \ - php7.0-mcrypt \ - php7.0-mysql +# Install PHP-CLI 7 and some useful Tools +RUN apt-get update \ + && apt-get install -y \ + php7.0-cli \ + php7.0-common \ + php7.0-curl \ + php7.0-json \ + php7.0-mbstring \ + php7.0-mcrypt \ + php7.0-mysql \ + git \ + curl \ + vim \ + nano -# Install some Tools -RUN apt-get install -y \ - git \ - curl \ - vim \ - nano - -# Setup the Composer installer +# Install Composer RUN curl -s http://getcomposer.org/installer | php \ && mv composer.phar /usr/local/bin/ \ && alias composer='/usr/local/bin/composer.phar' From 51b6d4f8447dc01ff059ce8a0479f08f727312e4 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Wed, 18 May 2016 04:38:46 +0300 Subject: [PATCH 11/53] update readme file (php section) --- README.md | 33 +++++++++++++++++---------------- workspace/Dockerfile | 3 ++- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 15f9d5ae..2fbae60f 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ docker-compose up nginx mysql redis - Easy switch between PHP versions: 7.0 - 5.6 - 5.5 ... - Choose your favorite database engine: MySQL - Postgres - Redis ... - Run your own combination of software's: Memcached - MariaDB ... -- Every software runs on a separate container: PHP - NGINX ... +- Every software runs on a separate container: PHP-FPM - NGINX ... - Easy to customize any container, with simple edit to the `dockerfile`. - All Images extends from an official base Image. (Trusted base Images). - Pre-configured Nginx for Laravel. @@ -78,7 +78,7 @@ docker-compose up nginx mysql redis ## Supported Containers -- PHP (7.0 - 5.6 - 5.5) +- PHP-FPM (7.0 - 5.6 - 5.5) - NGINX - MySQL - PostgreSQL @@ -88,6 +88,7 @@ docker-compose up nginx mysql redis - Beanstalkd - Beanstalkd Console - Data Volume +- Workspace (includes: `Git`, `Vim`, `nano`, `PHP-CLI 7.0`, `cURL`) >If you can't find your container, build it yourself and add it to this list. Contributions are welcomed :) @@ -139,7 +140,7 @@ Running a virtual Container is much faster than running a full virtual Machine. |-----------------------------------------------------------------------------------------|---------------------------------------------------------| | [Laravel](https://laravel.com/docs/master/installation) | [Laravel](https://laravel.com/docs/master/installation) | | [Git](https://git-scm.com/downloads) | [Git](https://git-scm.com/downloads) | -| [Docker Engine](https://docs.docker.com/engine/installation/linux/ubuntulinux/#install) | [Docker Toolbox](https://www.docker.com/toolbox) | +| [Docker Engine](https://docs.docker.com/engine/installation/linux/ubuntulinux) | [Docker Toolbox](https://www.docker.com/toolbox) | | [Docker Compose](https://docs.docker.com/compose/install) | | @@ -185,21 +186,21 @@ DB_HOST=xxx.xxx.xxx.xxx
*Make sure you are in the `docker` folder before running the `docker-compose` command.* -> Running PHP, NGINX, MySQL and Redis: +> Running PHP-FPM, NGINX, MySQL, Redis and the Data Containers: ```bash -docker-compose up -d php nginx mysql redis +docker-compose up -d nginx mysql redis ``` Note: you can choose your own combination of software's (containers), another example: -> Running PHP, NGINX, Postgres and Memcached: +> Running PHP-FPM, NGINX, Postgres, Memcached and the Data Containers: ```bash -docker-compose up -d php nginx postgres memcached +docker-compose up -d nginx postgres memcached ``` -Supported Containers: `nginx`, `mysql`, `redis`, `postgres`, `mariadb`, `memcached`, `beanstalkd`, `beanstalkd-console`, `data`, `php`. +Supported Containers: `nginx`, `mysql`, `redis`, `postgres`, `mariadb`, `memcached`, `beanstalkd`, `beanstalkd-console`, `data`, `php-fpm`, `workspace`.
3 - Open your browser and visit your `{Docker-IP}` address (`http://xxx.xxx.xxx.xxx`). @@ -284,26 +285,26 @@ To change the default PHP version: 1 - Open the `docker-compose.yml`. -2 - Search for `Dockerfile-php-70` in the PHP container section. +2 - Search for `Dockerfile-70` in the PHP container section. 3 - Change the version number.
-Example to select version 5.6 instead of 7.0 you have to replace `Dockerfile-php-70` with `Dockerfile-php-56`. +Example to select version 5.6 instead of 7.0 you have to replace `Dockerfile-70` with `Dockerfile-56`. Sample: ```txt -php: +php-fpm: build: - context: ./php - dockerfile: Dockerfile-php-70 + context: ./php-fpm + dockerfile: Dockerfile-70 ``` Supported Versions: -- For (PHP 7.0.*) use `Dockerfile-php-70` -- For (PHP 5.6.*) use `Dockerfile-php-56` -- For (PHP 5.5.*) use `Dockerfile-php-55` +- For (PHP 7.0.*) use `Dockerfile-70` +- For (PHP 5.6.*) use `Dockerfile-56` +- For (PHP 5.5.*) use `Dockerfile-55` 4 - Finally rebuild the container diff --git a/workspace/Dockerfile b/workspace/Dockerfile index d7de228f..c93c7f64 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -6,8 +6,9 @@ RUN DEBIAN_FRONTEND=noninteractive RUN locale-gen en_US.UTF-8 ENV LANGUAGE=en_US.UTF-8 -ENV LANG=en_US.UTF-8 ENV LC_ALL=en_US.UTF-8 +ENV LC_CTYPE=UTF-8 +ENV LANG=en_US.UTF-8 ENV TERM xterm # Install "software-properties-common" (for add-apt-repository) and add the "PHP 7" ppa From 377f24fe2b92842b67d6cad45fec24b37759b4af Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Wed, 18 May 2016 06:28:31 +0300 Subject: [PATCH 12/53] keep workspace container alive with tty --- docker-compose.yml | 2 ++ workspace/Dockerfile | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index bd8d26cf..eb1f0c79 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,6 +12,7 @@ services: - ./logs/nginx/:/var/log/nginx ports: - "80:80" + - "443:443" links: - php-fpm @@ -132,5 +133,6 @@ services: build: ./workspace volumes_from: - data + tty: true ### Add more Containers below ############################### diff --git a/workspace/Dockerfile b/workspace/Dockerfile index c93c7f64..9223b2ca 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -37,9 +37,8 @@ RUN curl -s http://getcomposer.org/installer | php \ && alias composer='/usr/local/bin/composer.phar' # Clean up -RUN rm -r /var/lib/apt/lists/* - -ENTRYPOINT ["top", "-b"] +RUN apt-get clean \ + && rm -r /var/lib/apt/lists/* WORKDIR /var/www/laravel From 6eb3a9bd5f8f9a6c3c1eaa926bf80093237086ac Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Wed, 18 May 2016 06:29:33 +0300 Subject: [PATCH 13/53] fix nginx not connecting to php port 9000 --- nginx/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nginx/Dockerfile b/nginx/Dockerfile index eb114931..495382fe 100644 --- a/nginx/Dockerfile +++ b/nginx/Dockerfile @@ -5,7 +5,7 @@ MAINTAINER Mahmoud Zalt ADD nginx.conf /etc/nginx/ ADD laravel.conf /etc/nginx/sites-available/ -RUN echo "upstream php-upstream { server php:9000; }" > /etc/nginx/conf.d/upstream.conf +RUN echo "upstream php-upstream { server php-fpm:9000; }" > /etc/nginx/conf.d/upstream.conf RUN usermod -u 1000 www-data From 1574231a8044560761e647b87cfcd18375034f62 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Wed, 18 May 2016 07:11:49 +0300 Subject: [PATCH 14/53] replace ubuntu 16.04 with lighter ubuntu version --- workspace/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workspace/Dockerfile b/workspace/Dockerfile index 9223b2ca..06fdb8cf 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:16.04 +FROM phusion/baseimage:latest MAINTAINER Mahmoud Zalt From 4d8a798224e9267ab999aa764686c6bd861e9005 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Wed, 18 May 2016 07:13:19 +0300 Subject: [PATCH 15/53] Create Application Container to hold App code --- README.md | 17 ++++++----------- application/Dockerfile | 7 +++++++ docker-compose.yml | 42 +++++++++++++++++++++++++----------------- 3 files changed, 38 insertions(+), 28 deletions(-) create mode 100644 application/Dockerfile diff --git a/README.md b/README.md index 2fbae60f..2660f158 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,8 @@ docker-compose up nginx mysql redis - Memcached - Beanstalkd - Beanstalkd Console -- Data Volume +- Data Volume *(Databases Data Container)* +- Application *(Application Code Container)* - Workspace (includes: `Git`, `Vim`, `nano`, `PHP-CLI 7.0`, `cURL`) >If you can't find your container, build it yourself and add it to this list. Contributions are welcomed :) @@ -186,21 +187,15 @@ DB_HOST=xxx.xxx.xxx.xxx
*Make sure you are in the `docker` folder before running the `docker-compose` command.* -> Running PHP-FPM, NGINX, MySQL, Redis and the Data Containers: +**Example:** Running NGINX, MySQL, Redis and the workspace: ```bash -docker-compose up -d nginx mysql redis +docker-compose up -d nginx mysql redis Workspace ``` +*Note: the PHP-FPM, Application and Data Containers will automatically run.* -Note: you can choose your own combination of software's (containers), another example: -> Running PHP-FPM, NGINX, Postgres, Memcached and the Data Containers: - -```bash -docker-compose up -d nginx postgres memcached -``` - -Supported Containers: `nginx`, `mysql`, `redis`, `postgres`, `mariadb`, `memcached`, `beanstalkd`, `beanstalkd-console`, `data`, `php-fpm`, `workspace`. +Supported Containers: `nginx`, `workspace`, `mysql`, `redis`, `postgres`, `mariadb`, `memcached`, `beanstalkd`, `beanstalkd-console`, `data`, `php-fpm`, `application`.
3 - Open your browser and visit your `{Docker-IP}` address (`http://xxx.xxx.xxx.xxx`). diff --git a/application/Dockerfile b/application/Dockerfile new file mode 100644 index 00000000..33c19660 --- /dev/null +++ b/application/Dockerfile @@ -0,0 +1,7 @@ +FROM debian:jessie + +MAINTAINER Mahmoud Zalt + +WORKDIR /var/www/laravel + +CMD ["true"] diff --git a/docker-compose.yml b/docker-compose.yml index eb1f0c79..b0d72653 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,33 +2,27 @@ version: '2' services: -### Nginx Server Container ################################## - - nginx: - build: ./nginx - volumes_from: - - php-fpm - volumes: - - ./logs/nginx/:/var/log/nginx - ports: - - "80:80" - - "443:443" - links: - - php-fpm - ### PHP-FPM Container ####################################### php-fpm: build: context: ./php-fpm dockerfile: Dockerfile-70 + volumes_from: + - application volumes: - - ../:/var/www/laravel - ./logs/php/:/usr/local/var/log expose: - "9000" -### DATA Container ########################################## +### Laravel Application Code Container ###################### + + application: + build: ./application + volumes: + - ../:/var/www/laravel + +### Databases Data Container ################################ data: build: ./data @@ -39,6 +33,20 @@ services: - /var/lib/redis - /var/lib/memcached +### Nginx Server Container ################################## + + nginx: + build: ./nginx + volumes_from: + - application + volumes: + - ./logs/nginx/:/var/log/nginx + ports: + - "80:80" + - "443:443" + links: + - php-fpm + ### MySQL Container ######################################### mysql: @@ -132,7 +140,7 @@ services: workspace: build: ./workspace volumes_from: - - data + - application tty: true ### Add more Containers below ############################### From 5ef193d55baf0e41809a9bbacb8a1ee68f22875f Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Wed, 18 May 2016 07:16:20 +0300 Subject: [PATCH 16/53] update readme --- README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2660f158..a12fb8d4 100644 --- a/README.md +++ b/README.md @@ -52,10 +52,10 @@ LaraDock strives to make the development experience easier. It contains pre-packaged Docker Images that provides you a wonderful development environment without requiring you to install PHP, NGINX, MySQL, REDIS, and any other software on your local machine. -**Usage Overview:** Run `NGINX`, `MySQL` and `Redis`. +**Usage Overview:** Run `NGINX` and `MySQL`. ```shell -docker-compose up nginx mysql redis +docker-compose up nginx mysql ``` @@ -225,6 +225,12 @@ sudo chmod -R 777 storage && sudo chmod -R 777 bootstrap/cache ```bash docker ps ``` +You can also use the this command if you want to see only this project containers: + +```bash +docker-compose ps +``` +
From 16a1041ef5f716d81513d8a884142709ee4e837e Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Wed, 18 May 2016 07:53:14 +0300 Subject: [PATCH 17/53] clean the workspace container --- workspace/Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/workspace/Dockerfile b/workspace/Dockerfile index 06fdb8cf..92207649 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -37,8 +37,7 @@ RUN curl -s http://getcomposer.org/installer | php \ && alias composer='/usr/local/bin/composer.phar' # Clean up -RUN apt-get clean \ - && rm -r /var/lib/apt/lists/* +RUN apt-get autoclean && apt-get clean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* WORKDIR /var/www/laravel - From 2c05c87400ad924d65e313c6d744966601fdd51e Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Wed, 18 May 2016 07:56:12 +0300 Subject: [PATCH 18/53] update the logs section --- README.md | 11 +++++++++-- docker-compose.yml | 6 ++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index a12fb8d4..26d7b042 100644 --- a/README.md +++ b/README.md @@ -374,7 +374,7 @@ DB_HOST=xxx.xxx.xxx.xxx Optionally you can define the server name in the nginx config file, like this: -``` +```conf server_name laravel.dev; ``` @@ -384,7 +384,14 @@ server_name laravel.dev;
#### View the Log files -The Log files are stored in the `docker/logs` directory. +The Nginx Log file is stored in the `logs/nginx` directory. + +However to view the logs of all the other containers (MySQL, PHP-FPM,...) you can run this: + +```bash +docker logs {container-id} +``` + diff --git a/docker-compose.yml b/docker-compose.yml index b0d72653..bc7ae53e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,8 +10,6 @@ services: dockerfile: Dockerfile-70 volumes_from: - application - volumes: - - ./logs/php/:/usr/local/var/log expose: - "9000" @@ -126,7 +124,7 @@ services: links: - php-fpm -### Beanstalkd-Console Container ############################ +### Beanstalkd Console Container ############################ beanstalkd-console: build: ./beanstalkd-console @@ -135,7 +133,7 @@ services: links: - beanstalkd -### Workspace Container ##################################### +### Workspace Utilities Container ########################### workspace: build: ./workspace From a69681b07cbc69ec20fbbba5d147948e9facf8f5 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Wed, 18 May 2016 07:58:33 +0300 Subject: [PATCH 19/53] install the php zip extention in the workspace --- workspace/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/workspace/Dockerfile b/workspace/Dockerfile index 92207649..efaf59b8 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -26,6 +26,7 @@ RUN apt-get update \ php7.0-mbstring \ php7.0-mcrypt \ php7.0-mysql \ + php7.0-zip \ git \ curl \ vim \ From fb4fcdcb2396525627ba9b8a784f914886f4e003 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Wed, 18 May 2016 08:07:54 +0300 Subject: [PATCH 20/53] Install the Laravel Installer in the workspace container --- workspace/Dockerfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/workspace/Dockerfile b/workspace/Dockerfile index efaf59b8..4eb0e4ae 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -37,6 +37,10 @@ RUN curl -s http://getcomposer.org/installer | php \ && mv composer.phar /usr/local/bin/ \ && alias composer='/usr/local/bin/composer.phar' +# Install Laravel Installer +RUN composer.phar global require "laravel/installer" \ + && export PATH="$PATH:$HOME/.composer/vendor/bin" + # Clean up RUN apt-get autoclean && apt-get clean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* From 07a07ab3ac750100b515dc52492d3e80644d8dc0 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Wed, 18 May 2016 08:23:53 +0300 Subject: [PATCH 21/53] install php xml in the workspace container --- workspace/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/workspace/Dockerfile b/workspace/Dockerfile index 4eb0e4ae..40603edb 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -23,6 +23,7 @@ RUN apt-get update \ php7.0-common \ php7.0-curl \ php7.0-json \ + php7.0-xml \ php7.0-mbstring \ php7.0-mcrypt \ php7.0-mysql \ From 66f08a4f60cf024ab03b3204a762fec7104c34a9 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Wed, 18 May 2016 08:40:08 +0300 Subject: [PATCH 22/53] fix .bashrc exports and alises --- workspace/Dockerfile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/workspace/Dockerfile b/workspace/Dockerfile index 40603edb..bff93260 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -36,11 +36,14 @@ RUN apt-get update \ # Install Composer RUN curl -s http://getcomposer.org/installer | php \ && mv composer.phar /usr/local/bin/ \ - && alias composer='/usr/local/bin/composer.phar' + && echo "alias composer='/usr/local/bin/composer.phar'" >> ~/.bashrc -# Install Laravel Installer +# Install the Laravel Installer RUN composer.phar global require "laravel/installer" \ - && export PATH="$PATH:$HOME/.composer/vendor/bin" + && echo "export PATH='$PATH:$HOME/.composer/vendor/bin'" >> ~/.bashrc + +# Source the bashrc to apply updates +RUN . ~/.bashrc # Clean up RUN apt-get autoclean && apt-get clean \ From 71719968437d5cc243aa488d4142a29937bb4a1b Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Wed, 18 May 2016 09:05:45 +0300 Subject: [PATCH 23/53] replace composer path --- workspace/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workspace/Dockerfile b/workspace/Dockerfile index bff93260..e604d5c4 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -40,7 +40,7 @@ RUN curl -s http://getcomposer.org/installer | php \ # Install the Laravel Installer RUN composer.phar global require "laravel/installer" \ - && echo "export PATH='$PATH:$HOME/.composer/vendor/bin'" >> ~/.bashrc + && echo "export PATH='~/.composer/vendor/bin:$PATH'" >> ~/.bashrc # Source the bashrc to apply updates RUN . ~/.bashrc From 3b2831bf1dba819807c91a4b38d2d1c1c7dfa8a1 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Wed, 18 May 2016 10:25:54 +0300 Subject: [PATCH 24/53] add alias for phpunit in the .bashrc --- README.md | 4 ++-- workspace/Dockerfile | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 26d7b042..e0da3d84 100644 --- a/README.md +++ b/README.md @@ -389,7 +389,7 @@ The Nginx Log file is stored in the `logs/nginx` directory. However to view the logs of all the other containers (MySQL, PHP-FPM,...) you can run this: ```bash -docker logs {container-id} +docker logs {container-name} ``` @@ -454,7 +454,7 @@ composer require predis/predis:^1.0 2 - enter any container using: ```bash -docker exec -it {container-name-or-id} bash +docker exec -it {container-name} bash ``` 3 - to exit a container, type `exit`. diff --git a/workspace/Dockerfile b/workspace/Dockerfile index e604d5c4..ee0605b6 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -42,7 +42,10 @@ RUN curl -s http://getcomposer.org/installer | php \ RUN composer.phar global require "laravel/installer" \ && echo "export PATH='~/.composer/vendor/bin:$PATH'" >> ~/.bashrc -# Source the bashrc to apply updates +# Add an alias for PHPUnit +RUN echo "alias phpunit='./vendor/bin/phpunit'" >> ~/.bashrc + +# Source the bash RUN . ~/.bashrc # Clean up From 5aa01b17572bdfe40b45e847d6eefd8ce5aab041 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Wed, 18 May 2016 11:12:21 +0300 Subject: [PATCH 25/53] add the new way of using LaraDock in the readme --- README.md | 72 +++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 57 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index e0da3d84..da0e9bdb 100644 --- a/README.md +++ b/README.md @@ -87,9 +87,10 @@ docker-compose up nginx mysql - Memcached - Beanstalkd - Beanstalkd Console +- Workspace (includes: Composer, PHP7-CLI , Laravel Installer, Git, Vim, Nano, cURL) - Data Volume *(Databases Data Container)* - Application *(Application Code Container)* -- Workspace (includes: `Git`, `Vim`, `nano`, `PHP-CLI 7.0`, `cURL`) + >If you can't find your container, build it yourself and add it to this list. Contributions are welcomed :) @@ -148,19 +149,60 @@ Running a virtual Container is much faster than running a full virtual Machine. ## Installation -1 - Clone the `LaraDock` repository, in any of your `Laravel` projects: +#### A] In existing Laravel Projects: + +1 - Clone the `LaraDock` repository, inside your `Laravel` project root direcotry: ```bash -git clone https://github.com/LaraDock/laradock.git docker +git submodule add https://github.com/LaraDock/laradock.git ``` -You can use `git submodule add` instead of `git clone` if you are already using Git for your Laravel project *(Recommended)*: +2 - That's it, jump to the Usage section now. + +*If you are not already using Git for your Laravel project, you can use `git clone` instead of `git submodule`.* + + +#### B] Starting from scratch (we will install Laravel): + +*If you don't have any Laravel project yet, and you want to start your Laravel project with Docker.* + +1 - Clone the `LaraDock` repository anywhere on your machine: ```bash -git submodule add https://github.com/LaraDock/laradock.git docker +git clone https://github.com/LaraDock/laradock.git ``` ->These commands should create a `docker` folder, on the root directory of your Laravel project. +2 - Go to the Uage section below and do the steps 1 and 3 then come back here. + +3 - Enter the Workspace container. (assuming you have the Workspace container running): + +```bash +docker exec -it {Workspace-Container-Name} bash +``` +Replace `{Workspace-Container-Name}` with your Workspace container name. To get the name type `docker-compose ps` and copy it. + +4 - Install Laravel anyway you like. + +Example using the Laravel Installer: + +```bash +laravel new my-cool-app +``` +For more about this check out this [link](https://laravel.com/docs/master#installing-laravel). + +5 - Edit `docker-compose.yml` to Map the new application path: + +By default LaraDock assumes the Laravel application is living in the parent directory of the laradock folder. + +Since the new Laravel application is in the `my-cool-app` folder, we should replace `../:/var/www/laravel` with `../my-cool-app/:/var/www/laravel`, as follow: + +```yaml + application: + build: ./application + volumes: + - ../my-cool-app/:/var/www/laravel +``` +6 - Finallt go to the Usage section below again and do steps 2 and 4. @@ -168,14 +210,14 @@ git submodule add https://github.com/LaraDock/laradock.git docker ## Usage -0 - For **Windows & MAC** users only: make sure you have a running Docker Virtual Host on your machine. +1 - For **Windows & MAC** users only: make sure you have a running Docker Virtual Host on your machine. (**Linux** users don't need a Virtual Host, so skip this step).
[How to run a Docker Virtual Host?](#Run-Docker-Virtual-Host)
-1 - Open your Laravel's `.env` file and set the `DB_HOST` to your `{Docker-IP}`: +2 - Open your Laravel's `.env` file and set the `DB_HOST` to your `{Docker-IP}`: ```env DB_HOST=xxx.xxx.xxx.xxx @@ -183,22 +225,22 @@ DB_HOST=xxx.xxx.xxx.xxx [How to find my Docker IP Address?](#Find-Docker-IP-Address)
-2 - Run the Containers, (you can select the software's (containers) that you wish to run) +3 - Run the Containers, (you can select the software's (containers) that you wish to run)
-*Make sure you are in the `docker` folder before running the `docker-compose` command.* +*Make sure you are in the `laradock` folder before running the `docker-compose` command.* -**Example:** Running NGINX, MySQL, Redis and the workspace: +**Example:** Running NGINX, MySQL, Redis and the Workspace: ```bash -docker-compose up -d nginx mysql redis Workspace +docker-compose up -d nginx mysql redis workspace ``` *Note: the PHP-FPM, Application and Data Containers will automatically run.* -Supported Containers: `nginx`, `workspace`, `mysql`, `redis`, `postgres`, `mariadb`, `memcached`, `beanstalkd`, `beanstalkd-console`, `data`, `php-fpm`, `application`. +Supported Containers: `workspace`, `nginx`, `mysql`, `redis`, `postgres`, `mariadb`, `memcached`, `beanstalkd`, `beanstalkd-console`, `data`, `php-fpm`, `application`.
-3 - Open your browser and visit your `{Docker-IP}` address (`http://xxx.xxx.xxx.xxx`). +4 - Open your browser and visit your `{Docker-IP}` address (`http://xxx.xxx.xxx.xxx`).
@@ -314,7 +356,7 @@ Supported Versions: docker-compose build php ``` -For more details visit the [official PHP docker images](https://hub.docker.com/_/php/). +For more details about the PHP base image, visit the [official PHP docker images](https://hub.docker.com/_/php/).
From 6d0ecaecf4f7e35e8f95dfcc8db30dec17636f11 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Wed, 18 May 2016 11:17:58 +0300 Subject: [PATCH 26/53] general updates to the readme files --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index da0e9bdb..65c5e980 100644 --- a/README.md +++ b/README.md @@ -149,7 +149,7 @@ Running a virtual Container is much faster than running a full virtual Machine. ## Installation -#### A] In existing Laravel Projects: +#### A - In existing Laravel Projects: 1 - Clone the `LaraDock` repository, inside your `Laravel` project root direcotry: @@ -162,7 +162,7 @@ git submodule add https://github.com/LaraDock/laradock.git *If you are not already using Git for your Laravel project, you can use `git clone` instead of `git submodule`.* -#### B] Starting from scratch (we will install Laravel): +#### B - From scratch (Install LaraDock and Laravel): *If you don't have any Laravel project yet, and you want to start your Laravel project with Docker.* @@ -202,7 +202,7 @@ Since the new Laravel application is in the `my-cool-app` folder, we should repl volumes: - ../my-cool-app/:/var/www/laravel ``` -6 - Finallt go to the Usage section below again and do steps 2 and 4. +6 - finally go to the Usage section below again and do steps 2 and 4. From 68aca9f8f9d91cf093a306fcca87db28e328b259 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Wed, 18 May 2016 11:24:09 +0300 Subject: [PATCH 27/53] small updates to the readme file --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 65c5e980..528bd973 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ docker-compose up nginx mysql - Memcached - Beanstalkd - Beanstalkd Console -- Workspace (includes: Composer, PHP7-CLI , Laravel Installer, Git, Vim, Nano, cURL) +- Workspace (includes: Composer, PHP7-CLI, Laravel Installer, Git, Vim, Nano and cURL) - Data Volume *(Databases Data Container)* - Application *(Application Code Container)* From 01bdaae690efe0d108a0d7c5e9e75aed6fa17f9d Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Wed, 18 May 2016 11:48:02 +0300 Subject: [PATCH 28/53] Add "Run Artisan Commands" to the readme --- README.md | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 528bd973..029b562f 100644 --- a/README.md +++ b/README.md @@ -29,11 +29,12 @@ It's like Laravel Homestead but for Docker instead of Vagrant. - [Close all running Containers](#Close-all-running-Containers) - [Delete all existing Containers](#Delete-all-existing-Containers) - [Build/Re-build Containers](#Build-Re-build-Containers) + - [Run Artisan Commands](#Run-Artisan-Commands) - [Change the PHP Version](#Change-the-PHP-Version) - [Add/Remove a Docker Container](#AddRemove-a-Docker-Container) - [Add more Software's (Docker Images)](#Add-Docker-Images) - [Edit default container configuration](#Edit-Container) - - [Use custom Domain](Use-custom-Domain) + - [Use custom Domain](#Use-custom-Domain) - [View the Log files](#View-the-Log-files) - [Use Redis](#Use-Redis) - [Enter a Container (SSH into a running Container)](#Enter-Container) @@ -318,6 +319,44 @@ docker-compose build {container-name} +
+ +#### Run Artisan Commands + +You can run artisan commands and many other Terminal commands from the Workspace container. + +1 - Make sure you have the workspace container running. + +```bash +docker-compose up -d workspace // ..and all your other containers +``` + +2 - Find the Workspace container name: + +```bash +docker-compose ps +``` + +3 - Enter the Workspace container: + +```bash +docker exec -it {workspace-container-name} bash +``` + +4 - Run anything you want :) + +```bash +php artisan +``` +```bash +Composer update +``` +```bash +phpunit +``` +```bash +laravel new blog +```
From 378181044c556ec748a316ba7de9b885648f9e6d Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Wed, 18 May 2016 20:21:15 +0300 Subject: [PATCH 29/53] update readme file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add “Change the PHP-CLI Version” - Add “Install PHP Extensions” --- README.md | 44 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 029b562f..8c3ec994 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,9 @@ It's like Laravel Homestead but for Docker instead of Vagrant. - [Delete all existing Containers](#Delete-all-existing-Containers) - [Build/Re-build Containers](#Build-Re-build-Containers) - [Run Artisan Commands](#Run-Artisan-Commands) - - [Change the PHP Version](#Change-the-PHP-Version) + - [Change the PHP-FPM Version](#Change-the-PHP-FPM-Version) + - [Change the PHP-CLI Version](#Change-the-PHP-CLI-Version) + - [Install PHP Extensions](#Install-PHP-Extensions) - [Add/Remove a Docker Container](#AddRemove-a-Docker-Container) - [Add more Software's (Docker Images)](#Add-Docker-Images) - [Edit default container configuration](#Edit-Container) @@ -358,12 +360,14 @@ phpunit laravel new blog ``` + +
- -#### Change the PHP Version -By default **PHP 7.0** is running. -
-To change the default PHP version: + +#### Change the PHP-FPM Version +By default **PHP-FPM 7.0** is running. + +>The PHP-FPM is responsible of serving your application code, you don't have to change the PHP-CLI version if you are planing to run your application on different PHP-FPM version. 1 - Open the `docker-compose.yml`. @@ -398,6 +402,34 @@ docker-compose build php For more details about the PHP base image, visit the [official PHP docker images](https://hub.docker.com/_/php/). + + +
+ +#### Change the PHP-CLI Version +By default **PHP-CLI 7.0** is running. + +>Note: it's not very essential to edit the PHP-CLI verion. The PHP-CLI is only used for the Artisan Commands & Composer. It doesn't serve your Application code, this is the PHP-FPM job. + +The PHP-CLI is installed in the Workspace container. To change the PHP-CLI version you need to edit the `workspace/Dockerfile`. + +Right now you have to manually edit the `Dockerfile` or create a new one like it's done for the PHP-FPM. (consider contributing). + + + + +
+ +#### Install PHP Extensions + +Before installing PHP extensions, you have to decide whether you need for the `FPM` or `CLI` because each lives on a different container, if you need it for both you have to edit both containers. + +The PHP-FPM extensions should be installed in `php-fpm/Dockerfile-XX`. *(replace XX with your default PHP version number)*. +
+The PHP-CLI extensions should be installed in `workspace/Dockerfile`. + + +
#### Add more Software's (Docker Images) From 77f9183c83d7cdfe299964cc93b31d4a50959c87 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Wed, 18 May 2016 20:56:48 +0300 Subject: [PATCH 30/53] reformat the readme file (organize all the sections) --- README.md | 477 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 287 insertions(+), 190 deletions(-) diff --git a/README.md b/README.md index 8c3ec994..eaa5612f 100644 --- a/README.md +++ b/README.md @@ -16,34 +16,36 @@ It's like Laravel Homestead but for Docker instead of Vagrant. - [Intro](#Intro) - [Features](#features) + - [Supported Containers](#Supported-Containers) - [What is Docker](#what-is-docker) - [What is Laravel](#what-is-laravel) - [Why Docker not Vagrant](#why-docker-not-vagrant) - [LaraDock VS Homestead](#laradock-vs-homestead) -- [Supported Containers](#Supported-Containers) - [Requirements](#Requirements) - [Installation](#Installation) - [Usage](#Usage) - [Documentation](#Documentation) - - [List current running Containers](#List-current-running-Containers) - - [Close all running Containers](#Close-all-running-Containers) - - [Delete all existing Containers](#Delete-all-existing-Containers) - - [Build/Re-build Containers](#Build-Re-build-Containers) - - [Run Artisan Commands](#Run-Artisan-Commands) - - [Change the PHP-FPM Version](#Change-the-PHP-FPM-Version) - - [Change the PHP-CLI Version](#Change-the-PHP-CLI-Version) - - [Install PHP Extensions](#Install-PHP-Extensions) - - [Add/Remove a Docker Container](#AddRemove-a-Docker-Container) - - [Add more Software's (Docker Images)](#Add-Docker-Images) - - [Edit default container configuration](#Edit-Container) - - [Use custom Domain](#Use-custom-Domain) - - [View the Log files](#View-the-Log-files) - - [Use Redis](#Use-Redis) - - [Enter a Container (SSH into a running Container)](#Enter-Container) - - [Edit a Docker Image](#Edit-a-Docker-Image) - - [Run a Docker Virtual Host](#Run-Docker-Virtual-Host) - - [Find your Docker IP Address](#Find-Docker-IP-Address) - + - [Docker](#Docker) + - [List current running Containers](#List-current-running-Containers) + - [Close all running Containers](#Close-all-running-Containers) + - [Delete all existing Containers](#Delete-all-existing-Containers) + - [Enter a Container (SSH into a running Container)](#Enter-Container) + - [Edit default container configuration](#Edit-Container) + - [Edit a Docker Image](#Edit-a-Docker-Image) + - [Build/Re-build Containers](#Build-Re-build-Containers) + - [Add more Software's (Docker Images)](#Add-Docker-Images) + - [View the Log files](#View-the-Log-files) + - [Laravel](#Laravel): + - [Run Artisan Commands](#Run-Artisan-Commands) + - [Use Redis](#Use-Redis) + - [PHP](#PHP) + - [Install PHP Extensions](#Install-PHP-Extensions) + - [Change the PHP-FPM Version](#Change-the-PHP-FPM-Version) + - [Change the PHP-CLI Version](#Change-the-PHP-CLI-Version) + - [Misc](#Misc) + - [Run a Docker Virtual Host](#Run-Docker-Virtual-Host) + - [Find your Docker IP Address](#Find-Docker-IP-Address) + - [Use custom Domain](#Use-custom-Domain) @@ -79,7 +81,7 @@ docker-compose up nginx mysql -## Supported Containers +### Supported Containers - PHP-FPM (7.0 - 5.6 - 5.5) - NGINX @@ -165,6 +167,7 @@ git submodule add https://github.com/LaraDock/laradock.git *If you are not already using Git for your Laravel project, you can use `git clone` instead of `git submodule`.* +
#### B - From scratch (Install LaraDock and Laravel): *If you don't have any Laravel project yet, and you want to start your Laravel project with Docker.* @@ -265,6 +268,13 @@ sudo chmod -R 777 storage && sudo chmod -R 777 bootstrap/cache ## Documentation + + + +### Docker + + + #### List current running Containers ```bash @@ -277,6 +287,9 @@ docker-compose ps ``` + + +
#### Close all running Containers @@ -292,6 +305,9 @@ docker-compose stop {container-name} + + +
#### Delete all existing Containers @@ -304,6 +320,83 @@ docker-compose down + + + +
+ +#### Enter a Container (SSH into a running Container) + +1 - first list the current running containers with `docker ps` + +2 - enter any container using: + +```bash +docker exec -it {container-name} bash +``` +3 - to exit a container, type `exit`. + + + + + + + +
+ +#### Edit default container configuration +Open the `docker-compose.yml` and change anything you want. + +Examples: + +Change MySQL Database Name: + +```yml + environment: + MYSQL_DATABASE: laradock +``` + +Change Redis defaut port to 1111: + +```yml + ports: + - "1111:6379" +``` + + + + + + + + +
+ +#### Edit a Docker Image + +1 - Find the `dockerfile` of the image you want to edit, +
+example for `mysql` it will be `mysql/Dockerfile`. + +2 - Edit the file the way you want. + +3 - Re-build the container: + +```bash +docker-compose build mysql +``` + +*If you find any bug or you have and suggestion that can improve the performance of any image, please consider contributing. Thanks in advance.* + + + + + + + + + +
#### Build/Re-build Containers @@ -321,7 +414,45 @@ docker-compose build {container-name} + + +
+ +#### Add more Software's (Docker Images) + +To add an image (software), just edit the `docker-compose.yml` and add your container details, to do so you need to be familiar with the [docker compose file syntax](https://docs.docker.com/compose/compose-file/). + + + + + + + + + +
+ +#### View the Log files +The Nginx Log file is stored in the `logs/nginx` directory. + +However to view the logs of all the other containers (MySQL, PHP-FPM,...) you can run this: + +```bash +docker logs {container-name} +``` + + + + + +
+ +### Laravel + + + + #### Run Artisan Commands @@ -362,149 +493,6 @@ laravel new blog -
- -#### Change the PHP-FPM Version -By default **PHP-FPM 7.0** is running. - ->The PHP-FPM is responsible of serving your application code, you don't have to change the PHP-CLI version if you are planing to run your application on different PHP-FPM version. - -1 - Open the `docker-compose.yml`. - -2 - Search for `Dockerfile-70` in the PHP container section. - -3 - Change the version number. -
-Example to select version 5.6 instead of 7.0 you have to replace `Dockerfile-70` with `Dockerfile-56`. - -Sample: - -```txt -php-fpm: - build: - context: ./php-fpm - dockerfile: Dockerfile-70 -``` - -Supported Versions: - -- For (PHP 7.0.*) use `Dockerfile-70` -- For (PHP 5.6.*) use `Dockerfile-56` -- For (PHP 5.5.*) use `Dockerfile-55` - - -4 - Finally rebuild the container - -```bash -docker-compose build php -``` - -For more details about the PHP base image, visit the [official PHP docker images](https://hub.docker.com/_/php/). - - - - -
- -#### Change the PHP-CLI Version -By default **PHP-CLI 7.0** is running. - ->Note: it's not very essential to edit the PHP-CLI verion. The PHP-CLI is only used for the Artisan Commands & Composer. It doesn't serve your Application code, this is the PHP-FPM job. - -The PHP-CLI is installed in the Workspace container. To change the PHP-CLI version you need to edit the `workspace/Dockerfile`. - -Right now you have to manually edit the `Dockerfile` or create a new one like it's done for the PHP-FPM. (consider contributing). - - - - -
- -#### Install PHP Extensions - -Before installing PHP extensions, you have to decide whether you need for the `FPM` or `CLI` because each lives on a different container, if you need it for both you have to edit both containers. - -The PHP-FPM extensions should be installed in `php-fpm/Dockerfile-XX`. *(replace XX with your default PHP version number)*. -
-The PHP-CLI extensions should be installed in `workspace/Dockerfile`. - - - -
- -#### Add more Software's (Docker Images) - -To add an image (software), just edit the `docker-compose.yml` and add your container details, to do so you need to be familiar with the [docker compose file syntax](https://docs.docker.com/compose/compose-file/). - - - -
- -#### Edit default container configuration -Open the `docker-compose.yml` and change anything you want. - -Examples: - -Change MySQL Database Name: - -```yml - environment: - MYSQL_DATABASE: laradock -``` - -Change Redis defaut port to 1111: - -```yml - ports: - - "1111:6379" -``` - - - -
- -#### Use custom Domain (instead of the Docker IP) - -Assuming your custom domain is `laravel.dev` and your current `Docker-IP` is `xxx.xxx.xxx.xxx`. - -1 - Open your `/etc/hosts` file and map your `Docker IP` to the `laravel.dev` domain, by adding the following: - -```bash -xxx.xxx.xxx.xxx laravel.dev -``` - -2 - Open your Laravel's `.env` file and replace the `127.0.0.1` default values with your `{Docker-IP}`. -
-Example: - -```env -DB_HOST=xxx.xxx.xxx.xxx -``` - -3 - Open your browser and visit `{http://laravel.dev}` - - - -Optionally you can define the server name in the nginx config file, like this: - -```conf -server_name laravel.dev; -``` - - - - -
- -#### View the Log files -The Nginx Log file is stored in the `logs/nginx` directory. - -However to view the logs of all the other containers (MySQL, PHP-FPM,...) you can run this: - -```bash -docker logs {container-name} -``` - @@ -558,50 +546,113 @@ composer require predis/predis:^1.0 -
- -#### Enter a Container (SSH into a running Container) -1 - first list the current running containers with `docker ps` - -2 - enter any container using: - -```bash -docker exec -it {container-name} bash -``` -3 - to exit a container, type `exit`. - - -
- -#### Add/Remove a Docker Container -To prevent a container (software) from running, open the `docker-compose.yml` file, and comment out the container section or remove it entirely.
- -#### Edit a Docker Image + +### PHP -1 - Find the `dockerfile` of the image you want to edit, + + + + + + +#### Install PHP Extensions + +Before installing PHP extensions, you have to decide whether you need for the `FPM` or `CLI` because each lives on a different container, if you need it for both you have to edit both containers. + +The PHP-FPM extensions should be installed in `php-fpm/Dockerfile-XX`. *(replace XX with your default PHP version number)*.
-example for `php` it will be `docker/php/dockerfile`. +The PHP-CLI extensions should be installed in `workspace/Dockerfile`. -2 - Edit the file the way you want. -3 - Re-build the container: -```bash -docker-compose build + + + + + + +
+ +#### Change the PHP-FPM Version +By default **PHP-FPM 7.0** is running. + +>The PHP-FPM is responsible of serving your application code, you don't have to change the PHP-CLI version if you are planing to run your application on different PHP-FPM version. + +1 - Open the `docker-compose.yml`. + +2 - Search for `Dockerfile-70` in the PHP container section. + +3 - Change the version number. +
+Example to select version 5.6 instead of 7.0 you have to replace `Dockerfile-70` with `Dockerfile-56`. + +Sample: + +```txt +php-fpm: + build: + context: ./php-fpm + dockerfile: Dockerfile-70 ``` -*If you find any bug or you have and suggestion that can improve the performance of any image, please consider contributing. Thanks in advance.* +Supported Versions: + +- For (PHP 7.0.*) use `Dockerfile-70` +- For (PHP 5.6.*) use `Dockerfile-56` +- For (PHP 5.5.*) use `Dockerfile-55` + + +4 - Finally rebuild the container + +```bash +docker-compose build php +``` + +For more details about the PHP base image, visit the [official PHP docker images](https://hub.docker.com/_/php/). + + + + +
+ +#### Change the PHP-CLI Version +By default **PHP-CLI 7.0** is running. + +>Note: it's not very essential to edit the PHP-CLI verion. The PHP-CLI is only used for the Artisan Commands & Composer. It doesn't serve your Application code, this is the PHP-FPM job. + +The PHP-CLI is installed in the Workspace container. To change the PHP-CLI version you need to edit the `workspace/Dockerfile`. + +Right now you have to manually edit the `Dockerfile` or create a new one like it's done for the PHP-FPM. (consider contributing). + + + + + + + + + + + +
+ +### Misc + + + + + #### Run a Docker Virtual Host @@ -627,6 +678,10 @@ eval $(docker-machine env) + + + +
#### Find your Docker IP Address @@ -647,6 +702,48 @@ Your IP Address is `127.0.0.1` + + + +
+ +#### Use custom Domain (instead of the Docker IP) + +Assuming your custom domain is `laravel.dev` and your current `Docker-IP` is `xxx.xxx.xxx.xxx`. + +1 - Open your `/etc/hosts` file and map your `Docker IP` to the `laravel.dev` domain, by adding the following: + +```bash +xxx.xxx.xxx.xxx laravel.dev +``` + +2 - Open your Laravel's `.env` file and replace the `127.0.0.1` default values with your `{Docker-IP}`. +
+Example: + +```env +DB_HOST=xxx.xxx.xxx.xxx +``` + +3 - Open your browser and visit `{http://laravel.dev}` + + + +Optionally you can define the server name in the nginx config file, like this: + +```conf +server_name laravel.dev; +``` + + + + + + + + + +
## Contributing From c3ff9e485b1d83c6a69c6ed5076c6089ac54fbe7 Mon Sep 17 00:00:00 2001 From: matt Date: Wed, 18 May 2016 20:20:16 +0100 Subject: [PATCH 31/53] Install node, npm, gulp and bower to the workspace container --- workspace/Dockerfile | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/workspace/Dockerfile b/workspace/Dockerfile index ee0605b6..689af99b 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -31,7 +31,10 @@ RUN apt-get update \ git \ curl \ vim \ - nano + nano \ + nodejs \ + nodejs-dev \ + npm # Install Composer RUN curl -s http://getcomposer.org/installer | php \ @@ -42,6 +45,12 @@ RUN curl -s http://getcomposer.org/installer | php \ RUN composer.phar global require "laravel/installer" \ && echo "export PATH='~/.composer/vendor/bin:$PATH'" >> ~/.bashrc +# Install gulp and bower +RUN npm install -g gulp bower + +# Add a symbolic link +RUN ln -s /usr/bin/nodejs /usr/bin/node + # Add an alias for PHPUnit RUN echo "alias phpunit='./vendor/bin/phpunit'" >> ~/.bashrc From 703887a2a6ae839de92ea8b4a7f26b1494ceed45 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Wed, 18 May 2016 22:54:43 +0300 Subject: [PATCH 32/53] add Node, Gulp and Bower to the readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index eaa5612f..dccfabe2 100644 --- a/README.md +++ b/README.md @@ -92,7 +92,7 @@ docker-compose up nginx mysql - Memcached - Beanstalkd - Beanstalkd Console -- Workspace (includes: Composer, PHP7-CLI, Laravel Installer, Git, Vim, Nano and cURL) +- Workspace (contains: Composer, PHP7-CLI, Laravel Installer, Git, Node, Gulp, Bower, Vim, Nano and cURL) - Data Volume *(Databases Data Container)* - Application *(Application Code Container)* From 7f1deb03429c26c8a99549807220f1daa1858990 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Thu, 19 May 2016 02:49:07 +0300 Subject: [PATCH 33/53] update how to get IP address on Linux, in the readme --- README.md | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index dccfabe2..056a9a50 100644 --- a/README.md +++ b/README.md @@ -691,14 +691,31 @@ eval $(docker-machine env) ```bash docker-machine ip default ``` +If your Host name is different then `default`, you have to specify it (`docker-machine ip my-host`). + *(The default IP is 192.168.99.100)* -**On Linux:** - -Your IP Address is `127.0.0.1` - > **boot2docker** users: run `boot2docker ip` *(when boot2docker is up)*. +
+**On Linux:** + +1 - Run `ifconfig` in the terminal. + +2 - In the result search for `docker0`, your IP address will be next to `inet addr`. + +Example: (In this example your IP address is `172.17.0.1`). + +```shell +docker0 Link encap:Ethernet HWaddr 02:42:41:2d:c4:24 + inet addr:172.17.0.1 Bcast:0.0.0.0 Mask:255.255.0.0 + UP BROADCAST MULTICAST MTU:1500 Metric:1 + RX packets:0 errors:0 dropped:0 overruns:0 frame:0 + TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) +``` +>If you have an easier way to do it, share it with us. From f0e2d83618ddf1818da9279896a78d4d04ccdbcf Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Thu, 19 May 2016 03:06:34 +0300 Subject: [PATCH 34/53] add sqlite in the workspace MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit it could be removed to it’s own container later --- workspace/Dockerfile | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/workspace/Dockerfile b/workspace/Dockerfile index 689af99b..8c7f5484 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -11,14 +11,16 @@ ENV LC_CTYPE=UTF-8 ENV LANG=en_US.UTF-8 ENV TERM xterm -# Install "software-properties-common" (for add-apt-repository) and add the "PHP 7" ppa -RUN apt-get update \ - && apt-get install -y software-properties-common \ - && add-apt-repository -y ppa:ondrej/php +# Install "software-properties-common" (for the "add-apt-repository") +RUN apt-get update && apt-get install -y \ + software-properties-common -# Install PHP-CLI 7 and some useful Tools -RUN apt-get update \ - && apt-get install -y \ +# Add the "PHP 7" ppa +RUN add-apt-repository -y \ + ppa:ondrej/php + +# Install PHP-CLI 7, some PHP extentions and some useful Tools with APT +RUN apt-get update && apt-get install -y \ php7.0-cli \ php7.0-common \ php7.0-curl \ @@ -27,7 +29,11 @@ RUN apt-get update \ php7.0-mbstring \ php7.0-mcrypt \ php7.0-mysql \ + php7.0-sqlite \ + php7.0-sqlite3 \ php7.0-zip \ + sqlite3 \ + libsqlite3-dev \ git \ curl \ vim \ @@ -36,6 +42,17 @@ RUN apt-get update \ nodejs-dev \ npm +# Install gulp and bower with NPM +RUN npm install -g \ + gulp \ + bower + +# Add a symbolic link for Node +RUN ln -s /usr/bin/nodejs /usr/bin/node + +# Add an alias for PHPUnit +RUN echo "alias phpunit='./vendor/bin/phpunit'" >> ~/.bashrc + # Install Composer RUN curl -s http://getcomposer.org/installer | php \ && mv composer.phar /usr/local/bin/ \ @@ -45,15 +62,6 @@ RUN curl -s http://getcomposer.org/installer | php \ RUN composer.phar global require "laravel/installer" \ && echo "export PATH='~/.composer/vendor/bin:$PATH'" >> ~/.bashrc -# Install gulp and bower -RUN npm install -g gulp bower - -# Add a symbolic link -RUN ln -s /usr/bin/nodejs /usr/bin/node - -# Add an alias for PHPUnit -RUN echo "alias phpunit='./vendor/bin/phpunit'" >> ~/.bashrc - # Source the bash RUN . ~/.bashrc From 1d8336a9e1143fc7f952b3c5916dd70553be22b2 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Thu, 19 May 2016 03:25:02 +0300 Subject: [PATCH 35/53] add cleaning to free some space during provisioning the workspace Fixing E: You don't have enough free space in /var/cache/apt/archives/ --- workspace/Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/workspace/Dockerfile b/workspace/Dockerfile index 8c7f5484..6e8524d4 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -42,6 +42,9 @@ RUN apt-get update && apt-get install -y \ nodejs-dev \ npm +# Clean up, to free some space +RUN apt-get clean + # Install gulp and bower with NPM RUN npm install -g \ gulp \ @@ -66,7 +69,6 @@ RUN composer.phar global require "laravel/installer" \ RUN . ~/.bashrc # Clean up -RUN apt-get autoclean && apt-get clean \ - && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* WORKDIR /var/www/laravel From 0959b25c0595bfab216d750161963a687bc2ea6f Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Thu, 19 May 2016 03:42:36 +0300 Subject: [PATCH 36/53] add sqlite support to the readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 056a9a50..78b5927c 100644 --- a/README.md +++ b/README.md @@ -92,7 +92,7 @@ docker-compose up nginx mysql - Memcached - Beanstalkd - Beanstalkd Console -- Workspace (contains: Composer, PHP7-CLI, Laravel Installer, Git, Node, Gulp, Bower, Vim, Nano and cURL) +- Workspace (contains: Composer, PHP7-CLI, Laravel Installer, Git, Node, Gulp, Bower, SQLite, Vim, Nano and cURL) - Data Volume *(Databases Data Container)* - Application *(Application Code Container)* From 70e1b0fe41e7f15f409d66e614b99798fc35d119 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Thu, 19 May 2016 18:04:53 +0300 Subject: [PATCH 37/53] update readme file --- README.md | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 78b5927c..2356e345 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ It's like Laravel Homestead but for Docker instead of Vagrant. - [Run a Docker Virtual Host](#Run-Docker-Virtual-Host) - [Find your Docker IP Address](#Find-Docker-IP-Address) - [Use custom Domain](#Use-custom-Domain) - +- [Help & Questions](#Help) @@ -256,12 +256,6 @@ Supported Containers: `workspace`, `nginx`, `mysql`, `redis`, `postgres`, `maria sudo chmod -R 777 storage && sudo chmod -R 777 bootstrap/cache ``` -
- - -[Follow @Mahmoud_Zalt](https://twitter.com/Mahmoud_Zalt) - -
@@ -764,27 +758,34 @@ server_name laravel.dev;
## Contributing -This little project was built by one man who has a full time job and many responsibilities, so if you like this project and you find that it needs a bug fix or support for new software or upgrade for the current containers, or anything else.. Do not hesitate to contribute, you are more than welcome :) - -All Docker Images can be found at [https://github.com/LaraDock](https://github.com/LaraDock) +This little project was built by one man who has a full time job and many responsibilities, so if you like this project and you find that it needs a bug fix or support for new software or upgrade any container, or anything else.. Do not hesitate to contribute, you are more than welcome :) ## Support -[Issues](https://github.com/laradock/laradock/issues) on Github. +To suggest a features or report a bug, open a new [Issue](https://github.com/laradock/laradock/issues). -### Questions? -If you have any question, send me a direct message on LaraChat, my username is `mahmoud_zalt`. + +## Help & Questions + +If you need help with anything related to this project, shedule a live call with me on [Codementor](https://www.codementor.io/mahmoudz), I'd love to help. + +If you have a short question, send me a direct message on LaraChat, my username is `mahmoud_zalt`. ## Credits [![Mahmoud Zalt](https://img.shields.io/badge/Author-Mahmoud%20Zalt-orange.svg)](http://www.zalt.me) +Twitter: [@Mahmoud_Zalt](https://twitter.com/Mahmoud_Zalt) +
+Website: [http://zalt.me](http://zalt.me) +
+Email: `mahmoud@zalt.me` ## License -[MIT License (MIT)](https://github.com/laradock/laradock/blob/master/LICENSE) -[]([]()) +[MIT License](https://github.com/laradock/laradock/blob/master/LICENSE) +[]([]()) (MIT) From 01a056dd250ac87430fbefe8615e1e417f518520 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Thu, 19 May 2016 20:49:16 +0300 Subject: [PATCH 38/53] make the workspace container run automatically --- README.md | 54 ++++++++++++++++++++++++++++------------------ docker-compose.yml | 2 ++ 2 files changed, 35 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 2356e345..14805efa 100644 --- a/README.md +++ b/README.md @@ -57,10 +57,10 @@ LaraDock strives to make the development experience easier. It contains pre-packaged Docker Images that provides you a wonderful development environment without requiring you to install PHP, NGINX, MySQL, REDIS, and any other software on your local machine. -**Usage Overview:** Run `NGINX` and `MySQL`. +**Usage Overview:** Run `NGINX`, `MySQL` and `Redis`. ```shell -docker-compose up nginx mysql +docker-compose up nginx mysql redis ``` @@ -93,7 +93,7 @@ docker-compose up nginx mysql - Beanstalkd - Beanstalkd Console - Workspace (contains: Composer, PHP7-CLI, Laravel Installer, Git, Node, Gulp, Bower, SQLite, Vim, Nano and cURL) -- Data Volume *(Databases Data Container)* +- Data *(Databases Data Container)* - Application *(Application Code Container)* @@ -178,14 +178,7 @@ git submodule add https://github.com/LaraDock/laradock.git git clone https://github.com/LaraDock/laradock.git ``` -2 - Go to the Uage section below and do the steps 1 and 3 then come back here. - -3 - Enter the Workspace container. (assuming you have the Workspace container running): - -```bash -docker exec -it {Workspace-Container-Name} bash -``` -Replace `{Workspace-Container-Name}` with your Workspace container name. To get the name type `docker-compose ps` and copy it. +2 - Go to the Uage section below and do the steps 1, 3 and 4 then come back here. 4 - Install Laravel anyway you like. @@ -194,13 +187,20 @@ Example using the Laravel Installer: ```bash laravel new my-cool-app ``` + +Example using Composer + +```bash +composer create-project laravel/laravel my-cool-app "5.1.*" +``` + For more about this check out this [link](https://laravel.com/docs/master#installing-laravel). 5 - Edit `docker-compose.yml` to Map the new application path: By default LaraDock assumes the Laravel application is living in the parent directory of the laradock folder. -Since the new Laravel application is in the `my-cool-app` folder, we should replace `../:/var/www/laravel` with `../my-cool-app/:/var/www/laravel`, as follow: +Since the new Laravel application is in the `my-cool-app` folder, we need to replace `../:/var/www/laravel` with `../my-cool-app/:/var/www/laravel`, as follow: ```yaml application: @@ -208,7 +208,8 @@ Since the new Laravel application is in the `my-cool-app` folder, we should repl volumes: - ../my-cool-app/:/var/www/laravel ``` -6 - finally go to the Usage section below again and do steps 2 and 4. + +6 - finally go to the Usage section below again and do steps 2 and 5. @@ -231,22 +232,34 @@ DB_HOST=xxx.xxx.xxx.xxx [How to find my Docker IP Address?](#Find-Docker-IP-Address)
-3 - Run the Containers, (you can select the software's (containers) that you wish to run) +3 - Run the Containers, (you can select the containers that you wish to run)
*Make sure you are in the `laradock` folder before running the `docker-compose` command.* -**Example:** Running NGINX, MySQL, Redis and the Workspace: +**Example:** Running NGINX, MySQL and Redis: ```bash -docker-compose up -d nginx mysql redis workspace +docker-compose up -d nginx mysql redis ``` -*Note: the PHP-FPM, Application and Data Containers will automatically run.* + +*Note: the PHP-FPM, Workspace, Application and Data Containers will automatically run.* -Supported Containers: `workspace`, `nginx`, `mysql`, `redis`, `postgres`, `mariadb`, `memcached`, `beanstalkd`, `beanstalkd-console`, `data`, `php-fpm`, `application`. +Supported Containers: `nginx`, `mysql`, `redis`, `postgres`, `mariadb`, `memcached`, `beanstalkd`, `beanstalkd-console`, `workspace`, `data`, `php-fpm`, `application`.
-4 - Open your browser and visit your `{Docker-IP}` address (`http://xxx.xxx.xxx.xxx`). + +4 - To execute commands like (Artisan, Composer, PHPUnit, Gulp, ...) you need to nter the Workspace container. + +```bash +docker exec -it {Workspace-Container-Name} bash +``` +Replace `{Workspace-Container-Name}` with your Workspace container name. +
+To find the containers names type `docker-compose ps`. + + +5 - Open your browser and visit your `{Docker-IP}` address (`http://xxx.xxx.xxx.xxx`).
@@ -787,5 +800,4 @@ Email: `mahmoud@zalt.me` ## License -[MIT License](https://github.com/laradock/laradock/blob/master/LICENSE) -[]([]()) (MIT) +[MIT License](https://github.com/laradock/laradock/blob/master/LICENSE) (MIT) diff --git a/docker-compose.yml b/docker-compose.yml index bc7ae53e..83d901c5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,6 +12,8 @@ services: - application expose: - "9000" + links: + - workspace ### Laravel Application Code Container ###################### From be7b8ee056a032741c5ca664aaa449a31d5b03cf Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Thu, 19 May 2016 21:40:25 +0300 Subject: [PATCH 39/53] update the readme (installation steps) --- README.md | 141 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 79 insertions(+), 62 deletions(-) diff --git a/README.md b/README.md index 14805efa..130a8a18 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ It's like Laravel Homestead but for Docker instead of Vagrant. - [Add more Software's (Docker Images)](#Add-Docker-Images) - [View the Log files](#View-the-Log-files) - [Laravel](#Laravel): + - [Install Laravel from a Docker Container](#Install-Laravel) - [Run Artisan Commands](#Run-Artisan-Commands) - [Use Redis](#Use-Redis) - [PHP](#PHP) @@ -151,95 +152,51 @@ Running a virtual Container is much faster than running a full virtual Machine. | [Docker Compose](https://docs.docker.com/compose/install) | | + + + + + ## Installation -#### A - In existing Laravel Projects: -1 - Clone the `LaraDock` repository, inside your `Laravel` project root direcotry: +1 - Clone the `LaraDock` repository. + +**A)** If you already have a Laravel project, clone this repository on your `Laravel` root direcotry: ```bash git submodule add https://github.com/LaraDock/laradock.git ``` +>If you are not already using Git for your Laravel project, you can use `git clone` instead of `git submodule`. -2 - That's it, jump to the Usage section now. - -*If you are not already using Git for your Laravel project, you can use `git clone` instead of `git submodule`.* - - -
-#### B - From scratch (Install LaraDock and Laravel): - -*If you don't have any Laravel project yet, and you want to start your Laravel project with Docker.* - -1 - Clone the `LaraDock` repository anywhere on your machine: +**B)** If you don't have a Laravel project, and you want to install Laravel from Docker, clone this repo anywhere on your machine: ```bash git clone https://github.com/LaraDock/laradock.git ``` -2 - Go to the Uage section below and do the steps 1, 3 and 4 then come back here. - -4 - Install Laravel anyway you like. - -Example using the Laravel Installer: - -```bash -laravel new my-cool-app -``` - -Example using Composer - -```bash -composer create-project laravel/laravel my-cool-app "5.1.*" -``` - -For more about this check out this [link](https://laravel.com/docs/master#installing-laravel). - -5 - Edit `docker-compose.yml` to Map the new application path: - -By default LaraDock assumes the Laravel application is living in the parent directory of the laradock folder. - -Since the new Laravel application is in the `my-cool-app` folder, we need to replace `../:/var/www/laravel` with `../my-cool-app/:/var/www/laravel`, as follow: - -```yaml - application: - build: ./application - volumes: - - ../my-cool-app/:/var/www/laravel -``` - -6 - finally go to the Usage section below again and do steps 2 and 5. - - ## Usage -1 - For **Windows & MAC** users only: make sure you have a running Docker Virtual Host on your machine. + +1 - For **Windows & MAC** users only: If you are not using the native Docker-Engine `Beta`, make sure you have a running Docker Virtual Host on your machine. (**Linux** users don't need a Virtual Host, so skip this step). -
+ [How to run a Docker Virtual Host?](#Run-Docker-Virtual-Host)
-2 - Open your Laravel's `.env` file and set the `DB_HOST` to your `{Docker-IP}`: - -```env -DB_HOST=xxx.xxx.xxx.xxx -``` -[How to find my Docker IP Address?](#Find-Docker-IP-Address) - -
-3 - Run the Containers, (you can select the containers that you wish to run) +2 - Run the Containers, (you can select the containers that you wish to run)
*Make sure you are in the `laradock` folder before running the `docker-compose` command.* -**Example:** Running NGINX, MySQL and Redis: +**Example:** Running NGINX and MySQL: ```bash -docker-compose up -d nginx mysql redis +docker-compose up -d nginx mysql ``` *Note: the PHP-FPM, Workspace, Application and Data Containers will automatically run.* @@ -247,9 +204,10 @@ docker-compose up -d nginx mysql redis Supported Containers: `nginx`, `mysql`, `redis`, `postgres`, `mariadb`, `memcached`, `beanstalkd`, `beanstalkd-console`, `workspace`, `data`, `php-fpm`, `application`. -
-4 - To execute commands like (Artisan, Composer, PHPUnit, Gulp, ...) you need to nter the Workspace container. + +
+3 - Enter the Workspace container, to execute commands like (Artisan, Composer, PHPUnit, Gulp, ...). ```bash docker exec -it {Workspace-Container-Name} bash @@ -259,6 +217,23 @@ Replace `{Workspace-Container-Name}` with your Workspace container name. To find the containers names type `docker-compose ps`. + +
+4 - Edit the Laravel configurations. + +If you don't have a Laravel project installed yet, see [How to Install Laravel in a Docker Container](#Install-Laravel). + +Open your Laravel's `.env` file and set the `DB_HOST` to your `{Docker-IP}`: + +```env +DB_HOST=xxx.xxx.xxx.xxx +``` +[How to find my Docker IP Address?](#Find-Docker-IP-Address) + + + + +
5 - Open your browser and visit your `{Docker-IP}` address (`http://xxx.xxx.xxx.xxx`). @@ -460,6 +435,48 @@ docker logs {container-name} + +## Install Laravel from a Docker Container + +1 - First you need to enter the Workspace Container. + +2 - Install Laravel anyway you like. + +Example using the Laravel Installer: + +```bash +laravel new my-cool-app +``` + +Example using Composer + +```bash +composer create-project laravel/laravel my-cool-app "5.1.*" +``` + +For more about this check out this [link](https://laravel.com/docs/master#installing-laravel). + + +3 - Edit `docker-compose.yml` to Map the new application path: + +By default LaraDock assumes the Laravel application is living in the parent directory of the laradock folder. + +Since the new Laravel application is in the `my-cool-app` folder, we need to replace `../:/var/www/laravel` with `../my-cool-app/:/var/www/laravel`, as follow: + +```yaml + application: + build: ./application + volumes: + - ../my-cool-app/:/var/www/laravel +``` +4 - Go to that folder and start working.. + +```bash +cd my-cool-app +``` + + + #### Run Artisan Commands From 19813e48c3605729987ff9fc8f89213abf1a6f6c Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Fri, 20 May 2016 09:24:26 +0300 Subject: [PATCH 40/53] add demo video to the readme --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 130a8a18..99ab20b1 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ It's like Laravel Homestead but for Docker instead of Vagrant. - [What is Laravel](#what-is-laravel) - [Why Docker not Vagrant](#why-docker-not-vagrant) - [LaraDock VS Homestead](#laradock-vs-homestead) +- [Demo Video](#Demo) - [Requirements](#Requirements) - [Installation](#Installation) - [Usage](#Usage) @@ -155,7 +156,10 @@ Running a virtual Container is much faster than running a full virtual Machine. + +## Demo Video +What's better than a [**Demo Video**](https://www.youtube.com/watch?v=-DamFMczwDA) :) ## Installation @@ -244,6 +248,8 @@ DB_HOST=xxx.xxx.xxx.xxx sudo chmod -R 777 storage && sudo chmod -R 777 bootstrap/cache ``` +
+If you have any problem, or need a special support. Feel free to contact me, more details in the [Help & Questions](#Help) secion.
@@ -801,7 +807,7 @@ To suggest a features or report a bug, open a new [Issue](https://github.com/lar If you need help with anything related to this project, shedule a live call with me on [Codementor](https://www.codementor.io/mahmoudz), I'd love to help. -If you have a short question, send me a direct message on LaraChat, my username is `mahmoud_zalt`. +If you have a short question, send me a direct message on LaraChat, my username is `mahmoud_zalt`. Or send me an email on `mahmoud@zalt.me`. ## Credits From 170b63a3ba8864706c99d84002a6010e065b907b Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Fri, 20 May 2016 09:26:29 +0300 Subject: [PATCH 41/53] edit redis volume --- redis/Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/redis/Dockerfile b/redis/Dockerfile index a0a4797b..35e4e97b 100644 --- a/redis/Dockerfile +++ b/redis/Dockerfile @@ -4,6 +4,8 @@ MAINTAINER Mahmoud Zalt #COPY redis.conf /usr/local/etc/redis/redis.conf +VOLUME /var/lib/redis + CMD [ "redis-server" ] EXPOSE 6379 From 588819ab6d84cc30afcd44f52d4b2b6887a6be41 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Fri, 20 May 2016 20:32:33 +0300 Subject: [PATCH 42/53] turn errors and access logs on by default for nginx --- nginx/nginx.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nginx/nginx.conf b/nginx/nginx.conf index 07708308..17ac8821 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -17,8 +17,8 @@ http { types_hash_max_size 2048; include /etc/nginx/mime.types; default_type application/octet-stream; - access_log off; - error_log off; + access_log on; + error_log on; gzip on; gzip_disable "msie6"; include /etc/nginx/conf.d/*.conf; From 5c9eb97db5adef1057ce7bb77dd9fc0a0cd7e529 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Fri, 20 May 2016 20:35:10 +0300 Subject: [PATCH 43/53] Support Neo4j DB (beta) --- docker-compose.yml | 13 +++++++++++++ neo4j/Dockerfile | 9 +++++++++ 2 files changed, 22 insertions(+) create mode 100644 neo4j/Dockerfile diff --git a/docker-compose.yml b/docker-compose.yml index 83d901c5..98caceb3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -32,6 +32,7 @@ services: - /var/lib/mariadb - /var/lib/redis - /var/lib/memcached + - /var/lib/neo4j ### Nginx Server Container ################################## @@ -94,6 +95,18 @@ services: links: - php-fpm +### Neo4j Container ######################################### + + neo4j: + build: ./neo4j + ports: + - "7474:7474" + - "7687:7687" + volumes_from: + - data + links: + - php-fpm + ### Redis Container ######################################### redis: diff --git a/neo4j/Dockerfile b/neo4j/Dockerfile new file mode 100644 index 00000000..fd17c241 --- /dev/null +++ b/neo4j/Dockerfile @@ -0,0 +1,9 @@ +FROM neo4j:3.0 + +MAINTAINER Mahmoud Zalt + +VOLUME /var/lib/neo4j + +EXPOSE 7474 7687 + +CMD ["neo4j"] From 8bff7656f6ae360f228c877f88c098b6214a8c41 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Fri, 20 May 2016 20:37:00 +0300 Subject: [PATCH 44/53] add neo4j support to the readme file --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 99ab20b1..cd11f72f 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,7 @@ docker-compose up nginx mysql redis - MySQL - PostgreSQL - MariaDB +- Neo4j - Redis - Memcached - Beanstalkd @@ -206,7 +207,7 @@ docker-compose up -d nginx mysql *Note: the PHP-FPM, Workspace, Application and Data Containers will automatically run.* -Supported Containers: `nginx`, `mysql`, `redis`, `postgres`, `mariadb`, `memcached`, `beanstalkd`, `beanstalkd-console`, `workspace`, `data`, `php-fpm`, `application`. +Supported Containers: `nginx`, `mysql`, `redis`, `postgres`, `mariadb`, `neo4j`, `memcached`, `beanstalkd`, `beanstalkd-console`, `workspace`, `data`, `php-fpm`, `application`. From 06c4c19a6fc7a0f85782002344017bec16f8deff Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Fri, 20 May 2016 21:21:19 +0300 Subject: [PATCH 45/53] replace official neo4j image with tpires/neo4j because of this wired error (https://github.com/neo4j/docker-neo4j/issues/33) --- docker-compose.yml | 6 ++++-- neo4j/Dockerfile | 8 +++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 98caceb3..1fb66102 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -32,7 +32,7 @@ services: - /var/lib/mariadb - /var/lib/redis - /var/lib/memcached - - /var/lib/neo4j + - /var/lib/neo4j/data ### Nginx Server Container ################################## @@ -101,7 +101,9 @@ services: build: ./neo4j ports: - "7474:7474" - - "7687:7687" + - "1337:1337" + environment: + - NEO4J_AUTH=homestead:secret volumes_from: - data links: diff --git a/neo4j/Dockerfile b/neo4j/Dockerfile index fd17c241..d1ebda6c 100644 --- a/neo4j/Dockerfile +++ b/neo4j/Dockerfile @@ -1,9 +1,7 @@ -FROM neo4j:3.0 +FROM tpires/neo4j MAINTAINER Mahmoud Zalt -VOLUME /var/lib/neo4j +VOLUME /var/lib/neo4j/data -EXPOSE 7474 7687 - -CMD ["neo4j"] +EXPOSE 7474 1337 From a8a7685a40bad8713332c6e8333c37a3e717db44 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Sat, 21 May 2016 19:19:03 +0300 Subject: [PATCH 46/53] basic changes to the readme format --- README.md | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index cd11f72f..6242d299 100644 --- a/README.md +++ b/README.md @@ -260,12 +260,12 @@ If you have any problem, or need a special support. Feel free to contact me, mor -### Docker +### [Docker] -#### List current running Containers +### List current running Containers ```bash docker ps ``` @@ -281,7 +281,7 @@ docker-compose ps
-#### Close all running Containers +### Close all running Containers ```bash docker-compose stop ``` @@ -299,7 +299,7 @@ docker-compose stop {container-name}
-#### Delete all existing Containers +### Delete all existing Containers ```bash docker-compose down ``` @@ -314,7 +314,7 @@ docker-compose down
-#### Enter a Container (SSH into a running Container) +### Enter a Container (SSH into a running Container) 1 - first list the current running containers with `docker ps` @@ -333,7 +333,7 @@ docker exec -it {container-name} bash
-#### Edit default container configuration +### Edit default container configuration Open the `docker-compose.yml` and change anything you want. Examples: @@ -361,7 +361,7 @@ Change Redis defaut port to 1111:
-#### Edit a Docker Image +### Edit a Docker Image 1 - Find the `dockerfile` of the image you want to edit,
@@ -388,7 +388,7 @@ docker-compose build mysql
-#### Build/Re-build Containers +### Build/Re-build Containers If you do any change to any `dockerfile` make sure you run this command, for the changes to take effect: @@ -408,7 +408,7 @@ docker-compose build {container-name}
-#### Add more Software's (Docker Images) +### Add more Software's (Docker Images) To add an image (software), just edit the `docker-compose.yml` and add your container details, to do so you need to be familiar with the [docker compose file syntax](https://docs.docker.com/compose/compose-file/). @@ -422,7 +422,7 @@ To add an image (software), just edit the `docker-compose.yml` and add your cont
-#### View the Log files +### View the Log files The Nginx Log file is stored in the `logs/nginx` directory. However to view the logs of all the other containers (MySQL, PHP-FPM,...) you can run this: @@ -437,13 +437,13 @@ docker logs {container-name}
-### Laravel +### [Laravel] -## Install Laravel from a Docker Container +### Install Laravel from a Docker Container 1 - First you need to enter the Workspace Container. @@ -484,8 +484,9 @@ cd my-cool-app +
-#### Run Artisan Commands +### Run Artisan Commands You can run artisan commands and many other Terminal commands from the Workspace container. @@ -531,7 +532,7 @@ laravel new blog
-#### Use Redis +### Use Redis 1 - First make sure you run the Redis Container with the `docker-compose` command. @@ -584,7 +585,7 @@ composer require predis/predis:^1.0
-### PHP +### [PHP] @@ -592,7 +593,7 @@ composer require predis/predis:^1.0 -#### Install PHP Extensions +### Install PHP Extensions Before installing PHP extensions, you have to decide whether you need for the `FPM` or `CLI` because each lives on a different container, if you need it for both you have to edit both containers. @@ -610,7 +611,7 @@ The PHP-CLI extensions should be installed in `workspace/Dockerfile`.
-#### Change the PHP-FPM Version +### Change the PHP-FPM Version By default **PHP-FPM 7.0** is running. >The PHP-FPM is responsible of serving your application code, you don't have to change the PHP-CLI version if you are planing to run your application on different PHP-FPM version. @@ -657,7 +658,7 @@ For more details about the PHP base image, visit the [official PHP docker images
-#### Change the PHP-CLI Version +### Change the PHP-CLI Version By default **PHP-CLI 7.0** is running. >Note: it's not very essential to edit the PHP-CLI verion. The PHP-CLI is only used for the Artisan Commands & Composer. It doesn't serve your Application code, this is the PHP-FPM job. @@ -678,14 +679,14 @@ Right now you have to manually edit the `Dockerfile` or create a new one like it
-### Misc +### [Misc] -#### Run a Docker Virtual Host +### Run a Docker Virtual Host These steps are only for **Windows & MAC** users *(Linux users don't need a virtual host)*: @@ -715,7 +716,7 @@ eval $(docker-machine env)
-#### Find your Docker IP Address +### Find your Docker IP Address **On Windows & MAC:** @@ -755,7 +756,7 @@ docker0 Link encap:Ethernet HWaddr 02:42:41:2d:c4:24
-#### Use custom Domain (instead of the Docker IP) +### Use custom Domain (instead of the Docker IP) Assuming your custom domain is `laravel.dev` and your current `Docker-IP` is `xxx.xxx.xxx.xxx`. From 7f91fc97986584b7ce7f9cf078a25112186e3698 Mon Sep 17 00:00:00 2001 From: Amin Mkh Date: Mon, 23 May 2016 21:45:38 +0300 Subject: [PATCH 47/53] Update README.MD --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6242d299..569b4ff4 100644 --- a/README.md +++ b/README.md @@ -246,7 +246,7 @@ DB_HOST=xxx.xxx.xxx.xxx **Debugging**: in case you faced an error here, run this command from the Laravel root directory: ```bash -sudo chmod -R 777 storage && sudo chmod -R 777 bootstrap/cache +sudo chmod -R 777 storage bootstrap/cache ```
From fd4253afb64b8c46507152e5eeaa8dec230db80c Mon Sep 17 00:00:00 2001 From: Amin Mkh Date: Mon, 23 May 2016 22:23:10 +0300 Subject: [PATCH 48/53] Update docker-compose.yml --- docker-compose.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 1fb66102..dd3ad77d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -61,8 +61,6 @@ services: MYSQL_USER: homestead MYSQL_PASSWORD: secret MYSQL_ROOT_PASSWORD: root - links: - - php-fpm ### PostgreSQL Container #################################### @@ -76,8 +74,6 @@ services: POSTGRES_DB: homestead POSTGRES_USER: homestead POSTGRES_PASSWORD: secret - links: - - php-fpm ### MariaDB Container ####################################### @@ -92,8 +88,6 @@ services: MYSQL_USER: homestead MYSQL_PASSWORD: secret MYSQL_ROOT_PASSWORD: root - links: - - php-fpm ### Neo4j Container ######################################### @@ -106,8 +100,6 @@ services: - NEO4J_AUTH=homestead:secret volumes_from: - data - links: - - php-fpm ### Redis Container ######################################### @@ -117,8 +109,6 @@ services: - data ports: - "6379:6379" - links: - - php-fpm ### Memcached Container ##################################### From c642560993fb437c0f22125b04bb5ca3d74638a0 Mon Sep 17 00:00:00 2001 From: Amin Mkh Date: Mon, 23 May 2016 23:20:07 +0300 Subject: [PATCH 49/53] added postgres driver added postgres driver to workspace container. --- workspace/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/workspace/Dockerfile b/workspace/Dockerfile index 6e8524d4..d85a9238 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -29,6 +29,7 @@ RUN apt-get update && apt-get install -y \ php7.0-mbstring \ php7.0-mcrypt \ php7.0-mysql \ + php7.0-pgsql \ php7.0-sqlite \ php7.0-sqlite3 \ php7.0-zip \ From adaaa25f479384bd2fcd66acda239e9c33d2d73a Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Mon, 23 May 2016 23:32:59 +0300 Subject: [PATCH 50/53] remove the Laravel installer from the workspace container --- README.md | 14 +++++--------- workspace/Dockerfile | 4 ---- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 569b4ff4..5cf1528c 100644 --- a/README.md +++ b/README.md @@ -447,21 +447,17 @@ docker logs {container-name} 1 - First you need to enter the Workspace Container. -2 - Install Laravel anyway you like. - -Example using the Laravel Installer: - -```bash -laravel new my-cool-app -``` +2 - Install Laravel. Example using Composer ```bash -composer create-project laravel/laravel my-cool-app "5.1.*" +composer create-project laravel/laravel my-cool-app "5.2.*" ``` -For more about this check out this [link](https://laravel.com/docs/master#installing-laravel). +> We recommand using `composer create-project` instead of the Laravel installer, to install Laravel. + +For more about the Laravel installation click [here](https://laravel.com/docs/master#installing-laravel). 3 - Edit `docker-compose.yml` to Map the new application path: diff --git a/workspace/Dockerfile b/workspace/Dockerfile index d85a9238..904c301c 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -62,10 +62,6 @@ RUN curl -s http://getcomposer.org/installer | php \ && mv composer.phar /usr/local/bin/ \ && echo "alias composer='/usr/local/bin/composer.phar'" >> ~/.bashrc -# Install the Laravel Installer -RUN composer.phar global require "laravel/installer" \ - && echo "export PATH='~/.composer/vendor/bin:$PATH'" >> ~/.bashrc - # Source the bash RUN . ~/.bashrc From 762e2ec07bbf35a13d139b6a5109872294eae6f6 Mon Sep 17 00:00:00 2001 From: Tom Witkowski Date: Tue, 24 May 2016 11:54:07 +0200 Subject: [PATCH 51/53] Issue #67 Issue #67 simpler docker IP-Address get command --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5cf1528c..91fa2699 100644 --- a/README.md +++ b/README.md @@ -728,7 +728,11 @@ If your Host name is different then `default`, you have to specify it (`docker-m
**On Linux:** -1 - Run `ifconfig` in the terminal. +1 - Run `ifconfig` in the terminal and follow step 2 - or grep the IP directly by the following command. + +```shell +$ ifconfig docker0 | grep 'inet' | cut -d: -f2 | awk '{ print $1}' | head -n1 +``` 2 - In the result search for `docker0`, your IP address will be next to `inet addr`. From ccbc73c6bc86e0422d0d1b2a5024bc3092d02bc7 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Tue, 24 May 2016 14:01:07 +0300 Subject: [PATCH 52/53] update the readme file --- README.md | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 91fa2699..a5934b2a 100644 --- a/README.md +++ b/README.md @@ -716,6 +716,8 @@ eval $(docker-machine env) **On Windows & MAC:** +Run this command in your terminal: + ```bash docker-machine ip default ``` @@ -723,34 +725,20 @@ If your Host name is different then `default`, you have to specify it (`docker-m *(The default IP is 192.168.99.100)* +
+ > **boot2docker** users: run `boot2docker ip` *(when boot2docker is up)*.
**On Linux:** -1 - Run `ifconfig` in the terminal and follow step 2 - or grep the IP directly by the following command. +Run this command in your terminal: ```shell -$ ifconfig docker0 | grep 'inet' | cut -d: -f2 | awk '{ print $1}' | head -n1 +ifconfig docker0 | grep 'inet' | cut -d: -f2 | awk '{ print $1}' | head -n1 ``` -2 - In the result search for `docker0`, your IP address will be next to `inet addr`. - -Example: (In this example your IP address is `172.17.0.1`). - -```shell -docker0 Link encap:Ethernet HWaddr 02:42:41:2d:c4:24 - inet addr:172.17.0.1 Bcast:0.0.0.0 Mask:255.255.0.0 - UP BROADCAST MULTICAST MTU:1500 Metric:1 - RX packets:0 errors:0 dropped:0 overruns:0 frame:0 - TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 - collisions:0 txqueuelen:0 - RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) -``` ->If you have an easier way to do it, share it with us. - - - +*(The default IP is 172.17.0.1)* From 991e28046d68c36082f89ea878617ff22df43087 Mon Sep 17 00:00:00 2001 From: Tom Witkowski Date: Tue, 24 May 2016 16:44:52 +0200 Subject: [PATCH 53/53] Issue #69 add memcached to php-cli --- workspace/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/workspace/Dockerfile b/workspace/Dockerfile index 904c301c..451cd76e 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -33,6 +33,7 @@ RUN apt-get update && apt-get install -y \ php7.0-sqlite \ php7.0-sqlite3 \ php7.0-zip \ + php7.0-memcached \ sqlite3 \ libsqlite3-dev \ git \