Skip to content

Instantly share code, notes, and snippets.

@ambiorixg12
Last active May 6, 2024 18:12
Show Gist options
  • Save ambiorixg12/0955b6c8459145db3379e739817fd368 to your computer and use it in GitHub Desktop.
Save ambiorixg12/0955b6c8459145db3379e739817fd368 to your computer and use it in GitHub Desktop.
docker lamp and phpmyadmin
version: '3.9'
services:
# MySQL Service
mysql-container:
image: mysql:8.0.30
container_name: mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: 789456
MYSQL_DATABASE: mydatabase
MYSQL_USER: admin
MYSQL_PASSWORD: 789456
volumes:
- mysql-data:/var/lib/mysql
ports:
- "3306:3306"
networks:
- mynet
healthcheck:
test: ["CMD-SHELL", "mysqladmin ping -uroot -p${MYSQL_ROOT_PASSWORD}"]
timeout: 10s
retries: 3
# Apache/PHP Service
webserver:
image: php:8.1-apache
container_name: apache_php
restart: always
volumes:
- ./php:/var/www/html
ports:
- "8080:80"
networks:
- mynet
depends_on:
mysql-container:
condition: service_healthy
# PhpMyAdmin Service
phpmyadmin:
image: phpmyadmin/phpmyadmin:5.2.0
container_name: phpmyadmin
restart: always
environment:
PMA_HOST: mysql
PMA_USER: root
PMA_PASSWORD: 789456
PMA_ABSOLUTE_URI: http://localhost:8081/
ports:
- "8081:80"
networks:
- mynet
networks:
mynet:
driver: bridge
volumes:
mysql-data:
#########################################
root@DevServer:/opt/docker_lamp# mysql -h 127.0.0.1 -u root -p789456
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment