Screencast Setting Up a Local PHP 7 Development Environment With Docker & Compose PHP

  • Hampton Paulk


  1. Aleksandr said

    Thanks codeschool and Hampton, I've been waiting for PHP and docker-related stuff quite for a while now. And we're getting it finally. Btw, do you happen to know whether any docker-related courses would be made in the nearest future?

  2. Klizzy said

    Thank you for the nice tutorial! But i get the following error after i use docker-compose build : Service 'php' failed to build: The command '/bin/sh -c apt-key list | grep "expired:"' returned a non-zero code: 1 Google didn't helped me much either..

  3. Benjamin Wagener said

    I think there are a lot users that would like to work on windows. So it would be cool, if there would be a tutorial for windows as well.

  4. Leandro Witzke said

    Hi Codescholl. If you can add subtitles to the screencast, I would appreciate it. I don't speak english and it is difficult to understand for me.

  5. Alexei Yuzhakov said

    Why not yo use a vanilla PHP 7 image from Docker Hub? You can also utilize "php -S" for webserver instead of nginx. It could be enough for simple cases.

  6. Aleksandr said

    Can't get it working. The following error appears during the execution of docker-compose build command:

    Step 6 : RUN apt-key list | grep "expired:" ---> Running in 9e3701ce8bf9 ERROR: Service 'php' failed to build: The command '/bin/sh -c apt-key list | grep "expired:"' returned a non-zero code: 1

    I'm trying doing this on Ubuntu 16.04. Any help would be appreciated.

  7. Faculty

    Hampton Paulk said

    Aleksandr, Please comment out that line in the docker file.

  8. Aleksandr said

    Thanks, Hampton. It did the trick. The 'php -v' references to the 7th version from now on.

  9. Aleksandr said

    Hello again,

    I'm still having issues with this (my last cheerful comment can be kinda ignored as I've forgotten to exec into the container itself and was actually displaying the php ver. of my current env...dummy mode activated, yeah) as I'm currently unable to bring everything up with 'docker-compose up'. It appears there is something wrong with the container's 3306 port which should be occupied by MySQL. Here's what I'm getting this time: "user@usergroup:/var/www/php7-dockerized$ sudo docker-compose up -d Creating network "php7dockerized_default" with the default driver Creating php7dockerized_mysql_1

    ERROR: for mysql Cannot start service mysql: driver failed programming external connectivity on endpoint php7dockerized_mysql_1 (5a53217434159b33cc556bf8fcead0c42d6a7383141783376ee8de90bd21fa1d): Error starting userland proxy: listen tcp bind: address already in use ERROR: Encountered errors while bringing up the project."

    Please, help. I'm in vain.

  10. Faculty

    Hampton Paulk said

    It looks like you already have a local copy of mysql running locally on your machine. Depending on how you have it set up you should just be able to stop the mysql service locally, and then run the docker commands again.

  11. Aleksandr said

    I've managed to deal with the 3306 port issue. The thing is that linux terminal shows the 3306 port as unoccupied (but it actually is). Tried to kill any processes running on that port by running the "sudo fuser -n tcp -k 3306" but to no avail. After some time later, I've tried to start the MySql service instead (sudo service mysql stop). And that did the trick and I finally managed to setup a container, exec into it and see the new env with php 7 at last. Well, thanks for everything.

    P.S. If there were any "The most annoying codeschool student" badges available, I bet I would've got several of them by now.

  12. Ravi Subedi said

    Getting the following error: mysql_1 | Initializing database mysql_1 | mysqld: Can't create/write to file '/var/lib/mysql/is_writable' (Errcode: 13 - Permission denied) mysql_1 | 2017-01-25T05:49:20.727208Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). mysql_1 | 2017-01-25T05:49:20.729521Z 0 [ERROR] --initialize specified but the data directory exists and is not writable. Aborting. mysql_1 | 2017-01-25T05:49:20.729763Z 0 [ERROR] Aborting

  13. Camilo Riviere said

    How do you get your terminal to look like that?

About This Screencast

In this episode, we will walk through how to install Docker, clone a custom repository, and run Docker Compose to create a local PHP 7 development environment.

You need to be an enrolled student in order to view this video and subscribe.

Enroll Now