I know its not recommended to run two services in a container but i’m afraid i will need it for a school project.
I want to have one dockerfile that installs both php and nginx.
I also need pdo installed on the php service (docker-php-ext-install pdo_mysql)
I have been trying out different suggestions / images but i have not been able to get this working so far.
Any help would be appreciated.
The docker-compose i want to use this dockerfile in looks like this:
version: "3.8" services: # PHP Service php: build: . depends_on: - mysql # MySQL Service mysql: image: mysql:8 environment: MYSQL_ROOT_PASSWORD: root MYSQL_DATABASE: demo volumes: - ./.docker/mysql/my.cnf:/etc/mysql/conf.d/my.cnf.ro - mysqldata:/lib/mysql # PHPMyAdmin Service phpmyadmin: image: phpmyadmin/phpmyadmin:5 ports: - 8080:80 environment: PMA_HOST: mysql depends_on: - mysql # Volumes volumes: mysqldata:
The reason i need pdo is to be able to user mysql.
Source: Docker Questions