hello i have this yml
file to get docker container working with phpmyadmin:
phpmyadmin:
image: phpmyadmin/phpmyadmin
restart: always
expose:
- 80
depends_on:
- database
volumes:
- /sessions
- ./bin/pma/php.ini:/usr/local/etc/php/conf.d/php-phpmyadmin.ini
extra_hosts:
- "host.docker.internal:host-gateway"
Important: I am working with YML
file and DOCKERFILE
only due to limitations in the use of the terminal
/cmd
, since it is not available in my Windows user.
Once you get it installed and everything will work correctly, go to see the structure of the container and the path where phpmyadmin is located is: /var/www/html
It occurred to me that just as I can see the document_root
of phpmiadmin
in xampp
/wampp
, I would try to see that of my docker container.
To achieve this try mounting a volume by adding the following line:
./bin/pma/phpmyadmin:/var/www/html
This is where the difficulties begin, the volume system that I implement is not designed for the scope of what I want.
since this method overwrites the content of the image with the content of the directory that I am mounting, this causes the directory to become empty… lol
What I’m trying to do is be able to mount a volume that references my local “windows” structure and bind to a directory within the container without replacing any files, so that I can see and modify these manually.
Another idea or failed attempt that I don’t like is to implement a symbolic link and command
in YML:
version: '3.8'
services:
phpmyadmin:
image: phpmyadmin/phpmyadmin
restart: always
expose:
- 80
depends_on:
- database
volumes:
- /sessions
- ./bin/pma/php.ini:/usr/local/etc/php/conf.d/php-phpmyadmin.ini
- ./bin/pma/phpmyadmin:/var/www/html/my_phpmyadmin
extra_hosts:
- "host.docker.internal:host-gateway"
command: sh -c "ln -s /var/www/html/my_phpmyadmin /var/www/html/phpmyadmin && apache2-foreground"
other implementation with symlink and Dockerfile
:
phpmyadmin:
container_name: PMA
build:
context: ./bin/pma
dockerfile: Dockerfile
restart: always
expose:
- 80
depends_on:
- database
volumes:
- /sessions
- ./bin/pma/php.ini:/usr/local/etc/php/conf.d/php-phpmyadmin.ini
- ./bin/pma/source-code:/var/www2/html
extra_hosts:
- "host.docker.internal:host-gateway"
Dockerfile:
FROM phpmyadmin/phpmyadmin
RUN mkdir -p /var/www2 && ln -s /var/www/html /var/www2/html
ENTRYPOINT ["apache2-foreground"]
Empty Directory:
It seems redundant or unnecessary to me to have to create a symbolic link to bind the symbolic link after, when the original directory already exists…
In the end the content should appear here: