Table of Contents

Docker

docker.sock: connect: permission denied

source: https://techoverflow.net/2018/12/15/how-to-fix-docker-got-permission-denied-while-trying-to-connect-to-the-docker-daemon-socket/

sudo usermod -a -G docker $USER

PHP 5.6

docker-compose.yml
version: '3'
services:
  webserver:
    build: .
    ports:
      - "80:80"
    volumes:
      - ./:/var/www/html
    environment:
      XDEBUG_CONFIG: remote_host=192.168.0.108  # on linux it needs to be a host ip, win: "docker.for.win.host.internal", mac:"docker.for.mac.host.internal"
    depends_on:
     - db
  
  db:
    image: mysql:5.6
    ports:
     - "3306:3306"
    volumes:
     - db-data:/var/lib/mysql:rw
    environment:
     MYSQL_ROOT_PASSWORD: "root" 
     MYSQL_DATABASE: "main"
  
  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    depends_on:
     - db
    environment:
     PMA_HOST: db
     PMA_PORT: 3306
    ports:
     - '8080:80'

volumes:
  db-data: {}
Dockerfile
FROM phpstorm/php-56-apache-xdebug-25
 
RUN docker-php-ext-install pdo pdo_mysql
 
RUN a2enmod rewrite
 
RUN echo 'date.timezone = "Europe/Prague"' >> /usr/local/etc/php/php.ini && \
    echo 'display_errors = on' >> /usr/local/etc/php/php.ini && \
    echo 'error_reporting = E_ALL' >> /usr/local/etc/php/php.ini
 
RUN usermod -u 1000 www-data && \
    usermod -G staff www-data

Import database dump

mysql -h 127.0.0.1 -u root -p main < dump.sql