docker icon indicating copy to clipboard operation
docker copied to clipboard

Additional password protection

Open huymluu opened this issue 8 years ago • 2 comments

My mysql db has weak username password - root/root. Is there any option to start docker which add htaccess layer for more secure? Thank you.

huymluu avatar Nov 12 '16 11:11 huymluu

Hi, I need this too, any solution for this now?

warrence avatar Aug 28 '17 06:08 warrence

  1. create apache-security.conf in your project or some where.
<Directory /var/www/html>
    AuthType Basic
    AuthName "Restricted Content"
    AuthUserFile /etc/httpd/.htpasswd
    Require valid-user
</Directory>
  1. create password file to your root project $ htpasswd -c .htpasswd USERNAME
  2. map to docker container
  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    restart: always
    environment:
      - PMA_HOST=XXX
      - MYSQL_ROOT_PASSWORD=XXX
    volumes:
      - ./.htpasswd:/etc/httpd/.htpasswd
      - ./apache-security.conf:/etc/apache2/conf-enabled/apache-security.conf
    ports:
      - 8080:80

Done!

liverbool avatar Jul 03 '20 09:07 liverbool