Initial configuration to install a web environment with the following images:
- nginx: it will be running as a reverse-proxy for Apache; the static data (images, texts, js scripts, etc) will be returned by nginx itself
- Php-fpm 7.2: it will install
composer
and try to run it withcomposer install
- Apache (httpd): it will be proxying the requests to PHP-FPM
- MySQL 8: default access credentials are defined in
.env
file incl. the root password - NodeJS: will try to run
npm run dev
ornpm run dev
depending on the settings defined in.env
file - phpMyAdmin: it will be available on the port
5426
, e.g.http://localhost:5426
Please make sure docker & docker-compose are installed on the target machine.
If you are not sure, please run the following command (Ubuntu):
sudo apt-get install docker docker-compose -y
Navigate to the root directory and open .env
file for editing:
# App Settings
APP_NAME=docker
APP_PATH=./app
# To launch the app in dev environment just remove prod
APP_ENV=prod
To build the images and run the configuration please navigate to the root directory and run the following command
docker-compose up -d --build
Remove option -d
if you don't want to run it in the detached mode.
If the images are already built just run the following command
docker-compose up -d
When the containers are built you can start the containers by using the following command
docker-compose up
OR docker-compose up -d
for the detached mode.
To stop Docker containers you can use the following command
docker-compose down
To log in to the container you can use one of the following commands
-
NGINX:
docker-compose exec web sh
-
PHP:
docker-compose exec php sh
-
APACHE:
docker-compose exec apache sh
-
MYSQL:
docker-compose exec db sh
-
NODEJS:
docker-compose exec nodejs sh
-
PHPMYADMIN:
docker-compose exec phpmyadmin sh
- Docker can't run the container on the default port
80
: Please check if there is no other app which uses the same port on your machine. You can also change the default port fornginx
in the filedocker-compose.yml
. - Can't log in to
php
container: Please check all running Docker processes by using the following commanddocker-compose ps
. Check if you are using the correct name.