I guess you don't have a MySQL database configured ...
Create an empty folder on the server
Inside the folder you created, add a new file and call it docker-compose.yml
Code:
version: "3"
services:
#--------------------------------------------------------------------------#
#--------------------------------------------------------------------------#
# C O D E I G N I T E R v4.0.2 #
#--------------------------------------------------------------------------#
#--------------------------------------------------------------------------#
codeigniter4:
image: atsanna/codeigniter4:latest
container_name: 'codeigniter4'
ports:
- 80:80
links:
- codeigniter4_mysql
volumes:
- ./localfolder/www:/var/www/html
#--------------------------------------------------------------------------#
#--------------------------------------------------------------------------#
# M Y S Q L #
#--------------------------------------------------------------------------#
#--------------------------------------------------------------------------#
codeigniter4_mysql:
image: mysql:8.0.19
container_name: 'codeigniter4_mysql'
ports:
- 3306:3306
volumes:
- ./localfolder/mysql:/var/lib/mysql
- ./localfolder/logs/mysql:/var/log/mysql
environment:
MYSQL_ROOT_PASSWORD: rootpassword
MYSQL_DATABASE: dbname
MYSQL_USER: codeigniter4
MYSQL_PASSWORD: codeigniter4
#--------------------------------------------------------------------------#
#--------------------------------------------------------------------------#
# P H P M Y A D M I N #
#--------------------------------------------------------------------------#
#--------------------------------------------------------------------------#
codeigniter4_phpmyadmin:
image: phpmyadmin/phpmyadmin:5.0.2
container_name: 'codeigniter4_phpmyadmin'
links:
- codeigniter4_mysql
environment:
PMA_HOST: codeigniter4_mysql
PMA_PORT: 3306
ports:
- 81:80
volumes:
- ./localfolder/sessions:/sessions
Change the following values
Code:
MYSQL_ROOT_PASSWORD: rootpassword
MYSQL_DATABASE: dbname
MYSQL_USER: codeigniter4
MYSQL_PASSWORD: codeigniter4
Now connect with the console in the path where you stored the file docker-compose.yml and type
Code:
docker-compose up -d
The necessary folders will be created and the services will start.
Now you need to configure codeigiter to connect to the mysql server at the localhost address on port 3306
at
http://yourserver you will find codeigniter
at
http://yourserver:81 replies phpmyadmin
To stop the services, always inside the folder where the docker-compose.yml file is located, you can type
Code:
docker-compose down --volumes