Hello and welcome to the course where I will teach you how Docker can help you with setting up and provisioning a specific development environment for your PHP project.
Even though I use PHP as an example, you can use the whole process for any other combination of microservices you need to use.
We will start with simple Docker commands, then we will move to Docker Compose.
I will explain how you can use Docker Compose to orchestrate the whole process of creating images and spinning up containers while creating volumes and mounting directories.
Next, we will take a look at GitHub. I will show you how easy it is to use your code stored in a public GitHub repository.
Finally, we will take a look at deployment to the remote server. In this final part, we will put everything together and provision our development environment remotely to Digital Ocean droplet while using code stored in GitHub repository.
Along the way, you should follow me step by step. I suggest you watch this course twice:
- For the first time, do exactly as I say and use my own examples.
- For the second time, try to use your own code stored locally and on your own GitHub account as well.
Attached, you will find the content I am referring to inside the course. It’s better to just copy and paste the code than to rewrite it line by line manually.
Enjoy the course and if you have any questions, don’t hesitate to drop me a line 🙂
Docker
I will explain how to set up the same environment I use. Get Atom.io along with terminal package and you are good to go!
In this lecture, I will show you step by step how to install Docker for Mac.
Here, we will take a look at Docker Hub, which is something like a central repository for Docker images. If you're familiar with GitHub, you'll feel right at home :)
In this lecture, we will create our first container! We will use official PHP image available on Docker Hub.
Can you build Docker image? Let's see!
In this lecture, we will create a container for MySQL database. Use the attached file if you don't want to type everything manually. You can use the file, just rename it to mysql.php or copy and paste its content to your own file.
This is the second part of MySQL container creation. We will address some important aspects.
Docker Compose
In this lecture, we will move on to some more exciting stuff. I will show you how Docker Compose helps you automate those tediuos steps we did manually in previous lectures.
In this lecture, we will create PHP container, but this time, we will use Docker Compose to help us. Use the attached files if you don't want to type everything manually. You can use those files, just rename them to index.php and default.conf or copy and paste their content to your own files.
In this lecture, I will show you how to fix the most common error people have with Nginx container and most importantly, how to find out what is wrong with you container.
In this lecture, I will explain volumes and how they can help you getting your code into the containers.
In this lecture, I will show you how to create MySQL container the Docker Compose way :) Also, attached you will find the extended version of index.php file. Again, you can just rename it to index.php and overwrite the original one or just copy and paste the added section to your own file.
I will take you to the trip deep down the rabbit hole. We will jump from your machine deep down inside the container and then, once more, inside mysql server to create a table in our database!
What is dangling volume and how to cope with it. That's what you will find out in this lecture.
Do you know what it is and how to work with it?
phpMyAdmin is the easiest way to manage your databases. After our trip to MySQL CLI, you might appreciate this alternative method.
Remote Development
If you have a public repository with your code on GitHub, make sure to take this lecture and learn how you can automatically get your repository inside your container!
Digital Ocean droplet provisioned with your complete development environment including the code from GitHub. That's what you will have at the end of this lecture.