Since I am new in docker I can pull images, create containers, list the running container. can able to run even nginx container into it. All these are okay to me.
I am a PHP developer I want to use docker in one of my projects how can I do that? Because while running a project we need to run server first then PHP and the MYSql server also required how to bind all these. Where to keep my web pages so that all these will run properly into web.
Please help.
Use Docker Compose: Here is my docker-compose.yml
version: '2’
services:
web:
build: .
ports:
- "8080:80"
volumes:
- ./www:/var/www/html
depends_on:
- appdb
links:
- appdb:appdb
environment:
MYSQL_ROOT_PASSWORD: ASecurePassword
MySQL_USER: AppUser
MYSQL_PASSWORD: AppUserPassword
MYSQL_HOST: appdb
MYSQL_DATABASE: appdatabase
container_name: opencart_web
appdb:
image: mysql
ports:
- "3306:3306"
volumes:
- /var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: ASecurePassword
MySQL_USER: AppUser
MYSQL_PASSWORD: AppUserPassword
MYSQL_DATABASE: appdatabase
container_name: opencart_db
restart: always
The problem I am having is when I view a php page, I am getting a message from MySQL on Access Denied. Google has let me down and I have not been able to solve it.
The problem is in “volume”, in “appdb”. To test this you try connect to MySQL with MySQL Workbench, if you remove volumes and run compose-up you can connect to MySQL Server.