Welcome Guest, Not a member yet? Register   Sign In
Codeigniter 4 and Docker
#11

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
Codeigniter 4 - Docker Image [github] [docker hub]
Reply


Messages In This Thread
Codeigniter 4 and Docker - by andybiancoblu - 09-26-2019, 07:11 AM
RE: Codeigniter 4 and Docker - by ciadmin - 09-26-2019, 07:38 AM
RE: Codeigniter 4 and Docker - by taliffsss - 04-21-2020, 07:11 PM
RE: Codeigniter 4 and Docker - by engel - 11-18-2019, 03:44 AM
RE: Codeigniter 4 and Docker - by john_brahy.com - 12-22-2019, 02:06 PM
RE: Codeigniter 4 and Docker - by InsiteFX - 12-23-2019, 04:26 AM
RE: Codeigniter 4 and Docker - by atsanna - 12-29-2019, 12:37 PM
RE: Codeigniter 4 and Docker - by MGatner - 01-02-2020, 09:03 AM
RE: Codeigniter 4 and Docker - by atsanna - 01-02-2020, 09:16 AM
RE: Codeigniter 4 and Docker - by atsanna - 04-13-2020, 10:31 AM
RE: Codeigniter 4 and Docker - by kenjis - 12-07-2020, 11:06 PM
RE: Codeigniter 4 and Docker - by mal2tin - 04-14-2020, 04:49 AM
RE: Codeigniter 4 and Docker - by atsanna - 04-14-2020, 08:30 AM
RE: Codeigniter 4 and Docker - by atsanna - 04-30-2020, 11:17 PM
RE: Codeigniter 4 and Docker - by Avenirer - 10-12-2020, 07:07 AM
RE: Codeigniter 4 and Docker - by tttt - 03-21-2022, 03:57 AM



Theme © iAndrew 2016 - Forum software by © MyBB