![]() ![]() ![]() I use this setup for websites I develop for clients, which are usually WordPress websites. One could do the same with the configuration file of phpmyadmin: store it in the _docker directory and map it to a path in the container./_docker/ Also, to persist the MariaDB databases, I’ve configured a Docker volume in order to keep my databases after a turn down of the container. version: '3' services: web: image: php74:latest ports: - '80:80' volumes: - /Users/vincentb/Sites/_docker/apache:/etc/apache2/sites-enabled - /Users/vincentb/Sites:/var/depends_on: - mariadb extra_hosts: - 'ax710.test:127.0.0.1' # - 'some-other-host.test:127.0.0.1' networks: - dev-env phpmyadmin: image: phpmyadmin:latest ports: - 8080 :80 environment: - PMA_ARBITRARY=1 - PMA_HOST=mariadb depends_on: - mariadb volumes: - /Users/vincentb/Sites/_docker/php/php.ini:/usr/local/etc/php/php.ini networks: - dev-env mariadb: image: mariadb:latest restart: always environment: MYSQL_ROOT_PASSWORD: 'secret' MYSQL_USER: 'vincentb' MYSQL_PASSWORD: 'secret' MYSQL_DATABASE: 'vincentb' volumes: - mysqldata: /var/lib/mysql ports: - 3306 :3306 networks: - dev-env volumes: mysqldata: Īs you can see I also have a php.ini file outside of the docker to persist PHP-specific configuration. ![]() One running Apache with Php74 and one with MariaDB, the real open source alternative to MySQL and one with PhpMyAdmin. With one command the compose file starts up three Docker containers. # before: /Users/vincentb/Sites/ # after: Options FollowSymLinks DocumentRoot "/var/www/html/" ServerName localhost I copied over the Apache configuration file from the former setup and only had to change all directory paths which map to the volumes directive in the Docker configuration. It uses Docker Compose which is basically a Yaml file with all we need. It took me quite some time before I got on the Docker boat □īasically I have a subdirectory in my ~/Sites directory which contains all Docker configuration. Her video, and a couple of results from Google, say the better tutorial blog post on Docker, resulted in the following setup and configuration. She has a great course on YouTube which lasts about 3 hours (2 hours on 1.5 the speed) digging deep into all features of Docker. ![]() I thought the learning curve was too steep, but that wasn’t actually true. I had heard about Docker a couple of years ago but I never had used it. I was fed up with dealing with a lot of administration with regard to running MacPorts and Homebrew: clean up, update, upgrade… Besides they took up a lot of disc space and I regularly had to clean up my MacBook in order to retain enough room for other applications. I deleted both and wrote a docker-compose.yml with about 50 SLOC that’s easier to maintain and easy to set up. But I found out both use an aweful lot of diskspace. I had both Macports and Homebrew installed… Why? I can’t recall actually. I was cleaning up my laptop as I had only 6Gb left on my 2013 MacBook Pro. This article describes a way to set up a MAMP development environment with Docker, Apache, PHP and MariaDB (i.e. MySQL). Production servers typically use took me quite some time before I got on the Docker boat (pun intended), but since last few weeks, I’m totally in. Auto-detect free ports will help you find available ports on your Mac. The button Set default MAMP ports will reset the ports for Apache, Nginx and MySQL to 8888, 88. The button Set ports to 80, 443 & 3306 will set the ports to the value commonly used on the internet. Should ports 8888, 8889 or 8890 be in use by a different application, please change the values accordingly. That way, the MAMP servers can run alongside other servers installed on your Mac. The default configuration for MAMP PRO uses ports 8888, 88. Every service has a default port: The Apache web server typically uses port 80, the MySQL database server utilises port 3306. This way, multiple server programs may run on one server machine. Server programs, when addressed via the network, need to be assigned to a certain network port. ![]()
0 Comments
Leave a Reply. |