This process will provide you with a Docker environment where you can quickly run PHP School Workshops. We've gone ahead and pre-installed a few for you such as learnyouphp
!
Once you get it up and running you should complete your tasks inside the code
directory and use an editor such as Atom to write them.
Everything in the code
directory will be mounted inside the Docker container at /phpschool/code
so you can navigate there using the cd
command and verify your solutions!
For example if your working on the Learn You PHP workshop you may do your first exercise Hello World
inside a learnyouphp
directory. Your verification process would be something like this.
cd code/learnyouphp
learnyouphp verify hello-world.php
Head on over to Docker and download the latest version for your OS.
Older Windows users running less than Windows 10 Professional or Enterprise 64bit Build 10586
will need to also follow the Special Windows Instructions throughout this process.
Older Windows users will require Docker Toolbox instead.
You will also need a better terminal capable of handling ANSI escape sequences, we recommend ConEmu
We recommend pulling this project down for the easiest way of getting started.
You can do this in two different ways, either with git
or manual download.
With git
just run
git clone [email protected]:php-school/docker-phpschool.git && cd docker-phpschool
Alternatively you can download the files directly and unzip them manually or run the command below to do it all in one.
curl -LOk https://github.com/php-school/docker-phpschool/archive/master.zip && unzip master.zip && cd docker-phpschool-master
Ensure you're in your terminal and have navigated to the directory of the files you just pulled down using the cd
command. If you ran one of the download commands above then you're already there otherwise if you manually downloaded the files and unzipped them you will need to run the command below replacing <path/to/download/folder>
with the download path for your OS.
cd <path/to/download/folder>/docker-phpschool-master
To use Docker with ConEmu you will need to configure the environment correctly, this is done in the startup tasks inside the settings menu. As you've installed Docker it should provide that as a predefined task, which you will need to set as the default task for new consoles as shown in the screenshot below. This simply ensures new consoles boot with the correct environment for working with Docker 🎉
You will also likely need to have the container up and running before you can interact with it using Docker (not Docker Compose) as Docker Compose does not yet support interactive commands 😞
To do this simply remember to run docker-compose up -d
before trying to interact with the workshops.
We've pre-installed a few Workshops for you and you can install more using the Workshop Manager which is also pre-installed.
To start a workshop you will need to interact directly with the Docker container, you should do this with the command below depending on your system
- Unix:
docker-compose run phpschool bash
- Windows:
docker exec -it phpschool bash
Note: The Windows command above is for those who had to run docker-compose up -d
beforehand
This will put you inside a new bash prompt interacting directly with the PHP School Docker container, from this point forwards you can start your interactive learning by running one of the pre-installed workshops e.g.
learnyouphp
Anyone familiar with Docker may wonder why we went through this process and maybe more inclined to run it directly in one command. Well here you go 😄
docker run -itv <local-dir>:/phpschool/code:rw -e "PATH=/root/.php-school/bin:$PATH" phpschool/phpschool bash
Replace <local-dir>
with a the directory you wish to complete your workshops in.
The source is built and pushed to Docker Hub automatically and will thus always be up to date with this repository.
Using Docker Compose you can build the image, this will include any modifications you make to your local Dockerfile.
docker-compose build phpschool
Thanks to our contributors for making this so easy!
We're always open to contributions. If you think you've spotted a bug or can help improve this process please open an issue or submit a PR ❤️