CodeIgniter 4 — Step 1: Let’s make ourselves some Docker containers — Avenirer

Adrian Voicu
7 min readOct 12, 2020

Hello, people. Long time, no tutorial…

I was thinking the other day about this thing called docker containers, and after all this time I still f***ing hate the idea of having this new stack over our main interest, the programming part. Why do we have to bother ourselves with these kind of problems, when we don’t even know how to program properly. Anyways…

Every time I want to start working with the “new” CodeIgniter 4 (it’s not so new, as it was launched quite some time ago), I have this big wall called “Docker containers”, even though it is not mentioned in the documentation, and it is not really necessary.

But, even though it is not necessary, let us be prepared for the deployment part, when the project is done. So, in order to be prepared for production, let’s start by launching the project the right way.

So, let’s dig into starting our docker stack by requiring Apache, PHP and MySQL (MariaDB). Before everything, I must warn you that you first need to install Docker and start it. I will not explain you how to install Docker. So, please, before continuing reading this article, do install Docker.

I’ve started by making the following directory structure:

project_folder
- db_data
- docker
- apache
- mysql
- src
- public

OK. So, we have a docker directory in which we put (almost) everything related to docker…

--

--