You have now installed Docker on your computer. Congratulations ! š„³ Now we will present you your home made environment.
But firstly, if you are completely new to Docker we recommend you to read the Docker Survival Guide.
Have a look at this folder. You have 2 files and 1 folder :
- docker-compose.yml
- Dockerfile
- src
The docker-compose.yml
and Dockerfile
are the configurations file in order to run your containers.
The src
folder is your work environment folder where you will code your PHP files. There is already a index.php
in it.
For working, you can paste the folder 03-docker-environment
in your computer, rename it as you want and follow the instructions below.
When starting your env for the first time, run the following command in your repo:
docker-compose build
NOTE: thus you don't need to run this command each time, it may be useful to rebuild your services when you change the configuration of your services.
Then, simply run the following command to get started:
docker-compose up
The details for all your services is detailed bellow.
PHP is a server-side scripting language designed for web development, but which can also be used as a general-purpose programming language. PHP can be added to straight HTML or it can be used with a variety of templating engines and web frameworks. PHP code is usually processed by an interpreter, which is either implemented as a native module on the web-server or as a common gateway interface (CGI).
- Website: php.net
- Documentation: php.net/docs.php
- Image used: library/php:apache
Place your PHP files in ./src
folder, access it with your browser at address localhost.
MariaDB is a community-developed fork of MySQL intended to remain free under the GNU GPL.
- Website: mariadb.org
- Documentation: mariadb.org/learn
- Image used: library/mariadb
NOTE: from dev POV, using MariaDB is strictly the same as using MySQL.
IMPORTANT: the first startup of this container is long : the db server needs to be initialized.
NOTE: the container don't create a database at startup - create it within your code (or with phpMyAdmin)
You can access the database from another container with the following informations:
- host:
mysql
- port:
3306
- user:
root
- pass:
root
You can access the database from you host with the following informations:
- host:
localhost
- port:
3306
- user:
root
- pass:
root
A web interface for MySQL and MariaDB.
- Website: phpmyadmin.net
- Documentation: phpmyadmin.net/docs
- Image used: phpmyadmin/phpmyadmin
The container is already configured to use the MySQL/MariaDB credentials.
Access phpMyAdmin with your browser at address localhost:8001.
MailHog is an email testing tool which allows you to install & configure an e-mail server locally.
- Website: github.com/mailhog/MailHog
- Explanations: mailtrap.io's blog
- More explainations: kinsta's blog
- Image used: mailhog/mailhog
Access MailHog's web interface with your browser at address localhost:8025.
Access MailHog's SMTP interface on port 1025
.