filmov
tv
ULTIMATE Docker with PHP APACHE MYSQL REDIS PHPMYADMIN
![preview_player](https://i.ytimg.com/vi/omAuPKDmm88/maxresdefault.jpg)
Показать описание
Create a network with Docker using PHP APACHE MYSQL REDIS PHPMYADMIN. Use "docker-compose up -d" and "docker-compose down" while keeping the data in sync between the host computer and the docker containers.
######################
version: '3'
services:
php_apache:
container_name: php_8.2_apache_container
build:
context: .
dockerfile: Dockerfile
ports:
- 80:80
volumes:
- C:\company:/var/www/html
networks:
- company_network
depends_on:
- mysql
mysql:
image: mysql:8.1.0
container_name: mysql_8.1.0_container
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: company
MYSQL_USER: root
ports:
- "3306:3306"
volumes:
- C:\company\mysql:/var/lib/mysql
networks:
- company_network
redis:
image: redis:7.2.1
container_name: redis_7.2.1_container
restart: always
ports:
- 6379:6379
networks:
- company_network
phpmyadmin:
image: phpmyadmin:5.2.1
container_name: phpmyadmin_container
restart: always
ports:
- 8080:80
environment:
- PMA_HOST=mysql
- PMA_PORT=3306
networks:
- company_network
networks:
company_network:
Dockerfile
###############
FROM php:8.2-apache
RUN pecl install redis && docker-php-ext-enable redis
RUN docker-php-ext-install pdo pdo_mysql
RUN a2enmod rewrite
######################
version: '3'
services:
php_apache:
container_name: php_8.2_apache_container
build:
context: .
dockerfile: Dockerfile
ports:
- 80:80
volumes:
- C:\company:/var/www/html
networks:
- company_network
depends_on:
- mysql
mysql:
image: mysql:8.1.0
container_name: mysql_8.1.0_container
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: company
MYSQL_USER: root
ports:
- "3306:3306"
volumes:
- C:\company\mysql:/var/lib/mysql
networks:
- company_network
redis:
image: redis:7.2.1
container_name: redis_7.2.1_container
restart: always
ports:
- 6379:6379
networks:
- company_network
phpmyadmin:
image: phpmyadmin:5.2.1
container_name: phpmyadmin_container
restart: always
ports:
- 8080:80
environment:
- PMA_HOST=mysql
- PMA_PORT=3306
networks:
- company_network
networks:
company_network:
Dockerfile
###############
FROM php:8.2-apache
RUN pecl install redis && docker-php-ext-enable redis
RUN docker-php-ext-install pdo pdo_mysql
RUN a2enmod rewrite
Комментарии