0

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:

enter image description here

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:

enter image description here

1 Answer 1

0

This doesn't make sense, but this is what I did to temporarily fix it.

YML:

 phpmyadmin: container_name: phpMyAdmin-Server build: context: ./bin/pma dockerfile: Dockerfile restart: always depends_on: - database volumes: - /sessions - ./bin/pma/php.ini:/usr/local/etc/php/conf.d/php-phpmyadmin.ini - ./bin/pma/app:/var/www/html copy-files: container_name: phpMyAdmin-Helper build: context: ./bin/pma dockerfile: Dockerfile restart: always depends_on: - phpmyadmin volumes: - ./bin/pma/app:/temp-dir command: sh -c "cp -r /var/www/html/* /temp-dir && chmod -R 777 /temp-dir/tmp/" 

Dockerfile:

FROM phpmyadmin/phpmyadmin RUN mkdir -p /temp-dir && \ chmod -R 777 /temp-dir 

It seems uncomfortable to me but I have had to deploy a second container just to copy the data... and mount it on the volume... it still seems wrong to me, they should not be necessary and there should be a type of volume that improves this issue... implementing it from the YML. Anyway now the problem is that if I stop and undock the Helper container the other container stops showing the phpmyadmin correctly, crazy but that's how it is...

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.