# Remove Dockerfile

**URL:** <https://forums.docker.com/t/remove-dockerfile/140519>\
**Category:** Compose\
**Created:** [March 26, 2024, 12:45pm UTC](https://forums.docker.com/t/remove-dockerfile/140519 "2024-03-26T12:45:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hack3rcon](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/hack3rcon/32/50683_2.png) [@hack3rcon](https://forums.docker.com/u/hack3rcon)\
**Post date:** [March 26, 2024, 12:45pm UTC](https://forums.docker.com/t/remove-dockerfile/140519/1 "2024-03-26T12:45:10Z")

</div>

Hello,  
To install and configure Apache, PHP, MySQL and PhpMyAdmin, I read the article https://thriveread.com/apache-php-with-docker-mysql-and-phpmyadmin/. I have some questions:

1- This article uses the **php:8.2-apache** package, but I want to install Apache and PHP separately. I changed the configuration file as follows:

```auto
version: "3.9"
services:
  webserver:
    image:httpd:latest
    container_name: Apache
    volumes:
      - /var/www/html:/usr/local/apache2/htdocs/
      - ./httpd.conf:/usr/local/apache2/conf/httpd.conf
    ports:
      - 8000:80
    depends_on:
      - mysql-db
      - php-fpm

  php-fpm:
    image: php:8-fpm
    container_name: PHP
    volumes:
       - /var/www/html:/usr/local/apache2/htdocs/

  mysql-db:
    image: mysql:latest
    container_name: MySQL
    environment:
      MYSQL_ROOT_PASSWORD: password
      MYSQL_DATABASE: test_database
      MYSQL_USER: db_user
      MYSQL_PASSWORD: password
    ports:
      - "3306:3306"

  phpmyadmin:
    image: phpmyadmin:latest
    container_name: PhpMyAdmin
    links:
      - mysql-db
    ports:
      - "8081:80"
    environment:
      PMA_HOST: mysql-db
      MYSQL_ROOT_PASSWORD: password

```

Is this configuration file correct?

2- The article uses **Dockerfile** and I don’t want that. How can I install the following extensions without needing a **Dockerfile**?

`docker-php-ext-install mysqli pdo pdo_mysql`

3- Why is PhpMyAdmin only linked to MySQL and not PHP?

Cheers.

---

<div class="post-metadata">

**Author:** ![sblee6206](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/sblee6206/32/46285_2.png) [@sblee6206](https://forums.docker.com/u/sblee6206)\
**Post date:** [March 27, 2024, 5:24am UTC](https://forums.docker.com/t/remove-dockerfile/140519/2 "2024-03-27T05:24:54Z")

</div>

Hello, hack3rcon

It seems that you are interested in installing and configuring Apache, PHP, MySQL, and phpMyAdmin using Docker. We will answer your questions.

1. Is this configuration file correct?

- Yes, the docker compose file you provided is configured correctly.

1. The article uses **Dockerfile** and I don’t want that. How can I install the following extensions without  
needing a **Dockerfile**?

- If you prefer to install extensions without using Dockerfile, it is limited except to directly use an image that  
contains PHP extensions or create a custom image.  
If additional extensions are needed, a common approach is to build a custom image using Dockerfile. It is  
difficult to dynamically add extensions without Dockerfile.

1. Why is PhpMyAdmin only linked to MySQL and not PHP?

- phpMyAdmin is a web-based MySQL database management tool that connects directly to the MySQL server.  
It does not connect to PHP itself, but interacts with MySQL by performing database operations through PHP  
code.

Thanks and cheers!  
Subin Lee.

---

<div class="post-metadata">

**Author:** ![hack3rcon](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/hack3rcon/32/50683_2.png) [@hack3rcon](https://forums.docker.com/u/hack3rcon)\
**Post date:** [March 27, 2024, 11:08am UTC](https://forums.docker.com/t/remove-dockerfile/140519/3 "2024-03-27T11:08:15Z")

</div>

Hello,  
Thank you so much for your reply.  
1- The Dockerfile of the article is as follows:

```auto
# Use an official PHP runtime
FROM php:8.2-apache
# Enable Apache modules
RUN a2enmod rewrite
# Install any extensions you need
RUN docker-php-ext-install mysqli pdo pdo_mysql
# Set the working directory to /var/www/html
WORKDIR /var/www/html
# Copy the source code in /www into the container at /var/www/html
COPY ../www .

```

I use **httpd:latest** image and added the following command in the YAML file:

```auto
command: a2enmod rewrite && apt update && apt install docker-php-ext-install mysqli pdo pdo_mysql

```

But I got the following error:

```auto
Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "a2enmod": executable file not found in $PATH: unknown

```

It seems that this problem is related to the image that I am using. How can I find out which commands an image supports?

2- About PhpMyAdmin, my question was that this management tool uses the PHP programming language, so it must be linked to PHP. Isn’t it?
