evertramos / docker-wordpress

Wordpress Docker container using SSL Certificates with LetsEncrypt
https://evertramos.github.io/docker-wordpress/
MIT License
484 stars 156 forks source link

Best way of integrating Phpmyadmin with Wordpress nginx-proxy letsencrypt configuration #11

Closed Julianoe closed 6 years ago

Julianoe commented 6 years ago

It's in the question. I'm looking for a way to extend this awesome package that is the wordpress-nginxproxy-letsencrypt to add a phpmyadmin container.

Do you have some advice or a guide to do it the good way.

For now here is what i tried with a docker-compose.yml file :

version: '3'
services:
  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    container_name: phpmyadmin
    # environment:
    #   - PMA_ARBITRARY=1
    restart: always
    ports:
      - 8080:80
    volumes:
      - /path/to/sessions
    links:
      - website1_db:db
      - website2_db:db
networks:
  default:
    external:
      name: webproxy

I commented out the arbitrary part because i could not connect. Even without it though the container returns the error message ERROR: Service 'phpmyadmin' has a link to service 'website_1:db' which is undefined. I thought i was doing it right.

I tried also to do it through a simple command for a single db container and it worked. I think i'm close but i can't figure out the rest :(

docker run --name website1_admin --link=website1_db:db -p 8080:80 --network=webproxy phpmyadmin/phpmyadmin

I could obviously do this for every wordpress/db install but i feel that it is a waste of resources.. am i right or it does not matter ? Also, i can't find a way to force the access to a certain url (and ideally https). Could we think of something together?

evertramos commented 6 years ago

This is not an issue....

But here is a working sample:

version: '3'

services:
    phpmyadmin:
      image: phpmyadmin/phpmyadmin
      container_name: phpmyadmin
      external_links:
        - db
      environment:
        VIRTUAL_HOST: phpmyadmin.budhi.com.br

networks:
    default:
      external:
        name: webproxy
evertramos commented 6 years ago

@Julianoe did you manage to get it working?

Julianoe commented 6 years ago

I did not fully managed to get it working because i did not have a dedicated host name but tomorrow i'll update the issues

evertramos commented 6 years ago

Well you don´t need actualy... you can just substitute as below:

version: '3'

services:
    phpmyadmin:
      image: phpmyadmin/phpmyadmin
      container_name: phpmyadmin
      external_links:
        - db
      ports:
        - 8080:80
#      environment:
#        VIRTUAL_HOST: phpmyadmin.budhi.com.br

networks:
    default:
      external:
        name: webproxy

And you access your domain.com:8080.