What steps to create a Docker image for Ubuntu 16:04, php 5.6 and apache (with Composer, xdebug, phpunit, npm and REDIS)?

2

I am a beginner in Docker and am trying to create an image with the following specifications:

  • The source OS has to be the original Ubuntu 16.04. I can not use images already available in the docker hub;
  • You must have installed apache - latest version;
  • You must have installed php and some libraries. It has to be php 5.5.38 (ideal) or 5.X last update or lastly 5.6.X latest update.
  • You must have REDIS installed.
  • REDIS, APACHE and php should be available as soon as the container is created, that is, initialized automatically.
  • The system root (/ var / www / html) should point to a / home / username / vhosts / mySite volume. The host is a MAC OS.
  • The system has to be accessed from the host browser through mysite-dev1 or mysite-dev2 or mysite-devN ...
  • The ultimate goal is to create an image that will be shared among all the company's developers.

    This is the Dockerfile I'm using:

    FROM ubuntu:16.04
    
    #1
    RUN apt-get update
    #2
    RUN apt-get install -y apache2
    #3
    RUN apt-get install -y php5
    #4
    RUN apt-get install -y redis-server
    #5
    RUN apt-get install -y php5-redis
    
    COPY /home/username/vhosts/mySite /var/www/html
    
    EXPOSE 80
    

    Next I'm encountering some errors:

    Operation # 3, php5 is not part of the ubuntu 16.04 package list. This post it turns out that it needs to be updated as follows:

    #6
    sudo add-apt-repository ppa:ondrej/php
    sudo apt-get update
    sudo apt-get upgrade
    sudo apt-get install php5.6 
    

    Operation # 6, I get an error saying that sudo is not recognized as a command (even if I try to run in iterative mode on the -ti terminal). Doing a search I find that sudo is not enabled in the Ubuntu16.04 image.

    If I try to run without sudo via terminal ( docker run -ti ... ), I get a message saying add-apt-repository not found .

    Doinga another search for this error I find that add-apt-repository is also not available for Ubuntu images 14.04 in docker. And apparently tbm is not available for 16.04. The proposed solution is to run:

    #7
    apt-get install -y software-properties-common python-software-properties
    

    Running this operation # 7 I get the following error: Doinganothersearch,Ifindthis post that suggests modifying apt.conf located in /etc/apt/apt.conf . And this is the contents of the apt directory from within the ubuntu 16.04 image .

    Thatis,itdoesnothaveapt.conf.Doingasearchonsomeapt.conf posts needs to be created.

    My conclusion is that I must be doing something very wrong because the goal is to just install php5.6 in Ubuntu16.04.

    In conclusion, would anyone know how to say some tried-and-tested way to create an image with the features listed above without going through the previous steps?

    UPDATE: It looks like other images have the same problem when they try to install version 5.6 of php .

        
    asked by anonymous 18.09.2017 / 21:43

    1 answer

    0

    Although Docker's ideology is to individualize processes by running each of them in different containers, I'll post my solution with REDIS here in a single container.

    It is worth noting the comments of @Luiz Carlos. Using REDIS inside the same container running php, apache, etc. is not a good practice.

    O Dockerfile : Prepared with php 5.6, Apache, PHPUnit, xdebug, REDIS, Composer, NPM.

    FROM php:5-apache
    
    ## Update apt-get
    RUN apt-get update
    
    RUN apt-get install -y figlet
    
    RUN figlet Docker_Build
    
    ## UTILITIES
    RUN figlet vim
    RUN apt-get install -y vim
    RUN figlet wget
    RUN apt-get install -y wget
    RUN figlet CURL
    RUN apt-get install -y curl
    
    ##===================================================== > ffmpeg stufs
    
    ## NOTE: Debian Jessie and later no longer include the ffmpeg, however you have 3 options for installing ffmpeg // https://superuser.com/questions/286675/how-to-install-ffmpeg-on-debian
    
    ## list of installed library packages only =>  https://askubuntu.com/questions/434154/how-to-get-the-list-of-installed-library-packages-only
    #ldconfig -v                # -v it will show the libraries versions
    #ldconfig -v | grep libname # Use grep to find a specific library by name.
    #RUN /sbin/ldconfig -p
    
    ## Installed 
    #RUN figlet
    #RUN apt-get install -y libav-tools
    
    ## https://superuser.com/questions/286675/how-to-install-ffmpeg-on-debian
    #root@b6a73f142787:/var/www/html# apt-cache search ffmpeg => List all plugins associated with ffmpeg
    
    #cmus-plugin-ffmpeg - lightweight ncurses audio player (FFmpeg plugin)
    RUN figlet cmus
    RUN apt-get install -y cmus
    
    #ffmpeg2theora - Theora video encoder using ffmpeg
    RUN figlet ffmpeg2theora
    RUN apt-get install -y ffmpeg2theora
    
    #ffmpegthumbnailer - fast and lightweight video thumbnailer
    RUN figlet ffmpegthumbnailer
    RUN apt-get install -y ffmpegthumbnailer
    
    #ffmpegthumbnailer-dbg - debugging informations for ffmpegthumbnailer
    RUN figlet ffmpegthumbnailer
    RUN apt-get install -y ffmpegthumbnailer-dbg
    
    #libffmpegthumbnailer-dev - development files for ffmpegthumbnailer
    RUN figlet libffmpegthumbnailer
    RUN apt-get install -y libffmpegthumbnailer-dev
    
    #libffmpegthumbnailer4 - shared library for ffmpegthumbnailer
    RUN figlet libffmpegthumbnailer4
    RUN apt-get install -y libffmpegthumbnailer4
    
    #ffmpegthumbs - video thumbnail generator using ffmpeg
    RUN figlet ffmpegthumbs
    RUN apt-get install -y ffmpegthumbs
    
    #libffms2-3 - Cross platform ffmpeg wrapper library
    RUN figlet libffms2
    RUN apt-get install -y libffms2-3
    
    #gmerlin-encoders-ffmpeg - ffmpeg encoders for Gmerlin
    RUN figlet
    RUN apt-get install -y gmerlin-encoders-ffmpeg
    
    #libpostproc-dev - FFmpeg derived postprocessing library - development headers
    RUN figlet libpostproc
    RUN apt-get install -y libpostproc-dev
    
    #libpostproc52 - FFmpeg derived postprocessing library
    RUN figlet libpostproc52
    RUN apt-get install -y libpostproc52
    
    #moc-ffmpeg-plugin - ncurses based console audio player - ffmpeg plugin
    RUN figlet moc-ffmpeg-plugin
    RUN apt-get install -y moc-ffmpeg-plugin
    
    #libtaoframework-ffmpeg-cil-dev - Tao CLI binding for FFmpeg - development files
    RUN figlet libtaoframework
    RUN apt-get install -y libtaoframework-ffmpeg-cil-dev
    
    #libtaoframework-ffmpeg0.4-cil - Tao CLI binding for FFmpeg
    RUN figlet libtaoframework
    RUN apt-get install -y libtaoframework-ffmpeg0.4-cil
    
    #winff - graphical video and audio batch converter using ffmpeg or avconv
    RUN figlet winff
    RUN apt-get install -y winff
    
    #libxine2-ffmpeg - MPEG-related plugins for libxine2
    RUN figlet libxine2
    RUN apt-get install -y libxine2-ffmpeg
    
    ## ListInstalledPackages => https://wiki.debian.org/ListInstalledPackages
    #RUN dpkg-query -l
    
    ## NOTE:
    ##need setup php variables date and maxupload file and others variables. ==> https://howto.biapy.com/en/debian-gnu-linux/servers/php/manage-php-ini-options-from-command-line-on-debian
    
    ##Install FFmpeg on Debian  => https://superuser.com/questions/286675/how-to-install-ffmpeg-on-debian
    #https://www.johnvansickle.com/ffmpeg/
    ## System modules
    
    #RUN apt-get install deb-multimedia-keyring
    #RUN apt-get update
    #RUN apt-get install -y ffmpeg
    
    ## ====================================================================== > End of ffmpeg stufs
    
    
    
    ## APACHE2  basic installation
    RUN figlet APACHE2
    RUN apachectl -M
    RUN a2enmod rewrite
    RUN a2enmod expires
    RUN service apache2 restart
    RUN apachectl -M
    
    
    ## ====================================================================== > PHP modules
    
    ## Note: when installing from php5 for some modules we need to copy from php5/mods-available to local/etc/php/conf.d and create a simbolic link
    RUN figlet PHP_MODULES
    RUN php -m
    
    RUN apt-get install -y php5-common
    
    RUN apt-get install -y php-calendar
    #RUN cp /etc/php5/mods-available/calendar.ini /usr/local/etc/php/conf.d && ln -s /usr/lib/php5/20131226/calendar.so /usr/local/lib/php/extensions/no-debug-non-zts-20131226/calendar.so
    
    #RUN docker-php-ext-install calendar 
    
    RUN docker-php-ext-install bcmath
    
    RUN apt-get install -y php5-mhash
    #RUN cp /etc/php5/mods-available/mhash.ini /usr/local/etc/php/conf.d && ln -s /usr/lib/php5/20131226/mhash.so /usr/local/lib/php/extensions/no-debug-non-zts-20131226/mhash.so
    
    RUN apt-get install -y php5-intl
    RUN cp /etc/php5/mods-available/intl.ini /usr/local/etc/php/conf.d && ln -s /usr/lib/php5/20131226/intl.so /usr/local/lib/php/extensions/no-debug-non-zts-20131226/intl.so
    
    RUN apt-get install -y php5-mcrypt
    RUN cp /etc/php5/mods-available/mcrypt.ini /usr/local/etc/php/conf.d && ln -s /usr/lib/php5/20131226/mcrypt.so /usr/local/lib/php/extensions/no-debug-non-zts-20131226/mcrypt.so
    
    RUN apt-get install -y php5-redis
    RUN cp /etc/php5/mods-available/redis.ini /usr/local/etc/php/conf.d && ln -s /usr/lib/php5/20131226/redis.so /usr/local/lib/php/extensions/no-debug-non-zts-20131226/redis.so
    
    RUN apt-get install -y php5-mysql
    RUN cp /etc/php5/mods-available/mysql.ini /usr/local/etc/php/conf.d && ln -s /usr/lib/php5/20131226/mysql.so /usr/local/lib/php/extensions/no-debug-non-zts-20131226/mysql.so
    
    RUN cp /etc/php5/mods-available/opcache.ini /usr/local/etc/php/conf.d
    
    RUN apt-get install -y php5-gd
    RUN cp /etc/php5/mods-available/gd.ini /usr/local/etc/php/conf.d && ln -s /usr/lib/php5/20131226/gd.so /usr/local/lib/php/extensions/no-debug-non-zts-20131226/gd.so
    
    RUN apt-get install -y php5-gdcm
    RUN cp /etc/php5/mods-available/gdcm.ini /usr/local/etc/php/conf.d && ln -s /usr/lib/php5/20131226/gdcm.so /usr/local/lib/php/extensions/no-debug-non-zts-20131226/gdcm.so
    
    RUN apt-get install -y php5-vtkgdcm
    RUN cp /etc/php5/mods-available/vtkgdcm.ini /usr/local/etc/php/conf.d && ln -s /usr/lib/php5/20131226/vtkgdcm.so /usr/local/lib/php/extensions/no-debug-non-zts-20131226/vtkgdcm.so
    
    RUN apt-get install -y php5-ldap
    RUN cp /etc/php5/mods-available/ldap.ini /usr/local/etc/php/conf.d && ln -s /usr/lib/php5/20131226/ldap.so /usr/local/lib/php/extensions/no-debug-non-zts-20131226/ldap.so
    
    RUN apt-get install -y php5-xsl
    RUN cp /etc/php5/mods-available/xsl.ini /usr/local/etc/php/conf.d && ln -s /usr/lib/php5/20131226/xsl.so /usr/local/lib/php/extensions/no-debug-non-zts-20131226/xsl.so
    
    RUN apt-get install -y php5-tidy
    RUN cp /etc/php5/mods-available/tidy.ini /usr/local/etc/php/conf.d && ln -s /usr/lib/php5/20131226/tidy.so /usr/local/lib/php/extensions/no-debug-non-zts-20131226/tidy.so
    
    RUN apt-get install -y php5-xmlrpc
    RUN cp /etc/php5/mods-available/xmlrpc.ini /usr/local/etc/php/conf.d && ln -s /usr/lib/php5/20131226/xmlrpc.so /usr/local/lib/php/extensions/no-debug-non-zts-20131226/xmlrpc.so
    
    RUN apt-get install -y php5-pgsql
    RUN cp /etc/php5/mods-available/pgsql.ini /usr/local/etc/php/conf.d && ln -s /usr/lib/php5/20131226/pgsql.so /usr/local/lib/php/extensions/no-debug-non-zts-20131226/pgsql.so
    
    
    RUN cp /etc/php5/mods-available/mysqli.ini /usr/local/etc/php/conf.d && ln -s /usr/lib/php5/20131226/mysqli.so /usr/local/lib/php/extensions/no-debug-non-zts-20131226/mysqli.so
    RUN cp /etc/php5/mods-available/pdo.ini /usr/local/etc/php/conf.d && ln -s /usr/lib/php5/20131226/pdo.so /usr/local/lib/php/extensions/no-debug-non-zts-20131226/pdo.so
    RUN cp /etc/php5/mods-available/pdo_mysql.ini /usr/local/etc/php/conf.d && ln -s /usr/lib/php5/20131226/pdo_mysql.so /usr/local/lib/php/extensions/no-debug-non-zts-20131226/pdo_mysql.so
    RUN cp /etc/php5/mods-available/pdo_pgsql.ini /usr/local/etc/php/conf.d && ln -s /usr/lib/php5/20131226/pdo_pgsql.so /usr/local/lib/php/extensions/no-debug-non-zts-20131226/pdo_pgsql.so
    RUN cp /etc/php5/mods-available/readline.ini /usr/local/etc/php/conf.d && ln -s /usr/lib/php5/20131226/readline.so /usr/local/lib/php/extensions/no-debug-non-zts-20131226/readline.so
    
    #RUN apt-get install -y php5-snmp
    #RUN cp /etc/php5/mods-available/snmp.ini /usr/local/etc/php/conf.d && ln -s /usr/lib/php5/20131226/snmp.so /usr/local/lib/php/extensions/no-debug-non-zts-20131226/snmp.so
    
    RUN figlet PHP_MODULES
    RUN php -m
    
    ## PHP extra modules
    #RUN apt-get install -y php-horde-date-parser  ##The command '/bin/sh -c apt-get install -y php-horde-date-parser' returned a non-zero code: 100
    #RUN apt-get install -y php-horde-date
    #RUN apt-get install -y php-horde-timezone
    #RUN apt-get install -y php-horde-timeobjects
    #RUN apt-get install -y php-timer
    
    
    
    #RUN apt-get install -y php-horde-icalendar
    #RUN apt-get install -y php-horde-kronolith
    #RUN apt-get install -y php-doctrine-dbal
    #RUN apt-get install -y phpldapadmin
    #RUN apt-get install -y php-horde-ldap
    #RUN apt-get install -y php-net-ldap
    #RUN apt-get install -y php-net-ldap2
    #RUN apt-get install -y php-mdb2-driver-pgsql
    #RUN apt-get install -y libnusoap-php
    #RUN apt-get install -y php-soap
    #RUN apt-get install -y php-fxsl
    #RUN apt-get install -y php-horde-text-filter-csstidy
    #RUN apt-get install -y php-pclzip
    #RUN apt-get install -y libphp-pclzip
    
    #RUN apt-get update
    
    #RUN cp /etc/php5/mods-available/json.ini /usr/local/etc/php/conf.d && ln -s /usr/lib/php5/20131226/json.so /usr/local/lib/php/extensions/no-debug-non-zts-20131226/json.so
    
    
    #Manage PHP ini options from command line on Debian => https://howto.biapy.com/en/debian-gnu-linux/servers/php/manage-php-ini-options-from-command-line-on-debian
    #RUN apt-get install -y php5-cli
    
    
    ### Note: Compare content
    
    #PHP5
    #cd /usr/local/etc/php/conf.d
    #cd /etc/php5/mods-available/
    
    
    #PHP 
    #cd /usr/local/lib/php/extensions/no-debug-non-zts-20131226
    #cd /usr/lib/php5/20131226/
    
    
    
    ## Note: when module is php5 need to make it available inside php/extensions (create a simbolic link)
    #RUN cp /etc/php5/mods-available/MODULE.ini /usr/local/etc/php/conf.d && ln -s /usr/lib/php5/20131226/MODULE.so /usr/local/lib/php/extensions/no-debug-non-zts-20131226/MODULE.so
    
    
    ## ====================================================================== > End of PHP modules
    
    
    
    
    ## ====================================================================== > REDIS
    RUN figlet REDIS
    RUN apt-get install -y telnet redis-server
    RUN apt-get install -y redis-server
    
    ## ====================================================================== > NPM
    RUN figlet NPM
    RUN apt-get install -y npm
    
    ## ====================================================================== > COPYING php.ini
    RUN figlet COPYING__php.ini
    RUN cp /etc/php5/cli/php.ini /usr/local/etc/php/
    RUN ls -l /usr/local/etc/
    
    ## ====================================================================== > XDEBUG
    # XDEBUG EXTENSION FOR PHP | DOCUMENTATION => https://xdebug.org/docs/remote 
    #
    # install xdebug and enable it. This block of code goes through the installion from source and compiling steps found
    # on the xdebug website
    # https://xdebug.org/docs/install
    RUN figlet INSTALLING__XDEBUG
    RUN cd /tmp \
        && wget http://xdebug.org/files/xdebug-2.5.4.tgz \
        && tar -xvzf xdebug-2.5.4.tgz \
        && cd xdebug-2.5.4 \
        && phpize \
        && ./configure  \
        && make \
        && cp modules/xdebug.so /usr/local/lib/php/extensions/no-debug-non-zts-20131226/
    
    RUN figlet INSIDE_no-debug-non-zts-20131226/         
    RUN ls -l /usr/local/lib/php/extensions/no-debug-non-zts-20131226/
    
    
    
    #https://stackoverflow.com/questions/47596381/how-to-setup-an-variable-env-inside-dockerfile-to-be-overriden-in-a-docker-conta?noredirect=1#comment82150863_47596381
    # ADD xdebug configurations
    RUN figlet SETTING__XDEBUG__php.ini
    RUN { \
            echo '[xdebug]'; \
            echo 'zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so'; \
            echo 'xdebug.remote_enable=1'; \
            echo 'xdebug.remote_port=9000'; \  
            echo 'xdebug.remote_autostart=1'; \
            echo 'xdebug.remote_handler=dbgp'; \
            echo 'xdebug.idekey=dockerdebug'; \
            echo 'xdebug.profiler_output_dir="/var/www/html"'; \
            echo 'xdebug.remote_connect_back=0'; \
            echo 'xdebug.remote_host=$REMOTE_HOST'; \
        } >> /usr/local/etc/php/php.ini
    
    
    
    RUN figlet XDEGUB__IN__php.ini
    RUN cat /usr/local/etc/php/php.ini
    
    
    #With an unknown IP/multiple developers
    #xdebug.remote_host
    #Type: string, Default value: localhost
    #Selects the host where the debug client is running, you can either use a host name, IP address, 
    #or 'unix:///path/to/sock' for a Unix domain socket. 
    #This setting is ignored if xdebug.remote_connect_back is enabled.
    
    #https://stackoverflow.com/questions/4421633/who-is-listening-on-a-given-tcp-port-on-mac-os-x
    #lsof -i :9001
    #netstat -anv | grep 9001
    
    
    #https://www.wikihow.com/Find-Your-IP-Address-on-a-Mac
    #ifconfig | grep "inet " | grep -v 127.0.0.1
    #   inet 10.20.1.210 netmask 0xfffffe00 broadcast 10.20.1.255
    
    #https://apple.stackexchange.com/questions/20547/how-do-i-find-my-ip-address-from-the-command-line
    #ifconfig | grep "inet " | grep -Fv 127.0.0.1 | awk '{print $2}'
    
    #https://serversforhackers.com/c/getting-xdebug-working
    
    #Debug your PHP in Docker with Intellij/PHPStorm and Xdebug
    #https://gist.github.com/chadrien/c90927ec2d160ffea9c4
    
    
    
    #https://github.com/laradock/laradock/issues/102
    #Pointing 9000 to php-fpm with xdebug enabled
    #https://forums.docker.com/t/ip-address-for-xdebug/10460/22
    
    
    
    
    
    
    
    ## ====================================================================== > COMPOSER
    
    RUN figlet Escape_SUDO
    RUN exit
    
    RUN figlet Install__COMPOSER
    RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
        && php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" \
        && php composer-setup.php \
        && php -r "unlink('composer-setup.php');" \
        && mv composer.phar /usr/bin/composer
    
    RUN composer
    
    
    ## ====================================================================== > PhpUnit
    
    RUN figlet PhpUnit
    RUN curl https://phar.phpunit.de/phpunit-5.6.0.phar -L -o phpunit.phar
    RUN chmod +x phpunit.phar
    RUN mv phpunit.phar /usr/local/bin/phpunit
    
    
    
    RUN figlet COPYING_entrypoint.sh
    COPY entrypoint.sh /usr/local/bin/
    RUN figlet Permission_entrypoint.sh
    RUN chmod +x /usr/local/bin/entrypoint.sh
    
    ENTRYPOINT [ "entrypoint.sh" ]
    
    # EXPOSE - PORTS
    RUN figlet EXPOSE_PORTS
    EXPOSE 80
    #EXPOSE 6379
    EXPOSE 9000
    CMD ["apache2-foreground"]
    
    
    
    ## ====================================================================== > Extra notes
    
    ## Clean up Docker
    #docker rm $(docker ps -a)
    #docker rmi $(docker images)
    #docker build -t my_img . 
    
    ## RUN REDIS 
    #Open up another terminal
    #docker  exec -it  xxxxxCOntainerId bash 
    #root@bxxxxxCOntainerId:/var/www/html# redis-server
    
    #If another terminal is needed to get acces to the container:
    #Open up another terminal
    #docker  exec -it  xxxxxCOntainerId bash 
    
    ## ============================         Export the desired image    
    ## Exit the container and commit in order to save the last state
    #docker commit e4a01807684f my_new_name_img
    
    ## Check the created image my_new_name_img is there
    #docker images
    #REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
    #my_new_name_img           latest              cc49bbaafd2d        15 seconds ago      771MB
    
    ## Tag the image // https://www.youtube.com/watch?v=svs-_9SAYz0
    #docker tag my_new_name_img  my_account_docker_hub/my_new_name_img:v001   
    
    
    ## Login.
    #docker login
    #myusername
    #mypassword
    
    ## Publish the image
    #docker push my_account_docker_hub/my_new_name_img:v001
    
    #Remove all images and all containers 
    #docker rmi -f $(docker images -q)
    #docker rm $(docker ps -a -q) 
    
    #Using the image just created and stored in the cloud
    ##docker run -p 80:80  -v path_to_your_project_folder:/var/www/html -e REMOTE_HOST=192.67.10.0 my_account_docker_hub/my_new_name_img:v001 apache2-foreground
    ## ou
    ##docker run -p 80:80  -v path_to_your_project_folder:/var/www/html -e REMOTE_HOST=$REMOTE_HOST my_account_docker_hub/my_new_name_img:v001 apache2-foreground
    
    #Note: REMOTE_HOST is your local IP. That value will be used inside xdebug.remote_host. 
    #Esse valor é importante para permitir uma conexão entre o xdebug e o IDE, principalmente o Intellij ou o PHPstrom. 
    #No primeiro exemplo a variável $REMOTE_HOST pode ser usada em um script BASH  
    #REMOTE_HOST='ifconfig | grep "inet " | grep -Fv 127.0.0.1 | awk '{print $2}'' 
    #para carregar o container automaticamente sem necessidade de passar o IP
    
    # Documentation
    #    https://docs.docker.com/engine/reference/commandline/pull/#proxy-configuration
    #    https://docs.docker.com/docker-hub/orgs/
    #    https://docs.docker.com/engine/reference/commandline/commit/
    #    https://docs.docker.com/get-started/part2/#run-the-app
    #    http://jasani.org/2014/11/19/docker-now-supports-adding-host-mappings/
    #    https://docs.docker.com/engine/reference/commandline/push/#parent-command
    #    https://docs.docker.com/docker-cloud/orgs/#convert-a-user-to-an-organization
    #    http://www.tldp.org/LDP/Bash-Beginners-Guide/html/Bash-Beginners-Guide.html#chap_07
    #    https://medium.com/ihme-tech/using-xdebug-with-intellij-inside-a-docker-container-dc8cbd844dc5
    #    https://www.npmjs.com/package/redis-commander
    #    https://www.youtube.com/watch?v=kQ3H_jhyW2w
    #    https://docs.docker.com/samples/library/redis/
    #    https://docs.docker.com/engine/reference/run/#network-settings
    #    https://docs.docker.com/engine/reference/run/
    #    http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_04_02.html
    #    https://stackoverflow.com/questions/6207573/how-to-append-output-to-the-end-of-text-file-in-shell-script-bash
    #    http://www.linuxfromscratch.org/lfs/view/6.1/chapter07/hosts.html
    #    http://www.linfo.org/cat.html
    #    https://redislabs.com/blog/so-youre-looking-for-the-redis-gui/
    
    #http://tarunlalwani.com/post/debugging-php-xdebug-docker/
    #https://medium.com/ihme-tech/using-xdebug-with-intellij-inside-a-docker-container-dc8cbd844dc5
    #https://stackoverflow.com/questions/47357783/xdebug-with-intellij-and-docker-is-not-working-how-to-solve-it?noredirect=1#comment81686964_47357783
    #https://xdebug.org/docs/remote
    #https://stackoverflow.com/questions/46263043/how-to-setup-docker-phpstorm-xdebug-on-ubuntu-16-04/46265103#46265103
    #http://www.mysolutions.it/phpstorm-server-xdebug-configuration/    
    
    # How could I ping my docker container from my host // https://stackoverflow.com/questions/39216830/how-could-i-ping-my-docker-container-from-my-host
    # docker inspect 64ad351e115f give me "IPAddress": "172.17.0.2",
    # How to get a Docker container's IP address from the host? docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' 64ad351e115f 172.17.0.2
    

    This is the entrypoint.sh that will inject the ip dynamically in php.ini by going to xdebug.remote_host:

    #!/bin/bash
    set -e
    
    # Check if our environment variable has been passed.
    if [ -z "${REMOTE_HOST}" ]
    then
      echo "REMOTE_HOST has not been set."
      exit 1
    else
      sed -i.bak "s/\$REMOTE_HOST/${REMOTE_HOST}/g" /usr/local/etc/php/php.ini
    fi
    
    exec "$@"
    
        
    05.12.2017 / 14:23