With individual Docker commands
- Install Docker for Mac
- $ docker run –name mysql-latest -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:latest
- $ docker run –name wordpress -p 8000:80 –link mysql-latest:mysql -d wordpress:4.7.3-php7.1-apache
- Visit http://0.0.0.0:8000 and configure WordPress
With a Docker compose file
- Install Docker for Mac
- Save the following text to a ´~/dev /wordpress /website /docker-compose.yml´ file:
version: '2' services: dbms: image: mysql:5.7 volumes: - db_data:/var/lib/mysql ports: - 32768:3306 restart: always environment: MYSQL_ROOT_PASSWORD: wordpress MYSQL_DATABASE: wordpress MYSQL_USER: wordpress MYSQL_PASSWORD: wordpress wordpress: depends_on: - dbms build: ./docker/wordpress image: wordpress:xdebug volumes: - .:/var/www/html ports: - 8000:80 restart: always environment: WORDPRESS_DB_HOST: dbms:3306 WORDPRESS_DB_PASSWORD: wordpress XDEBUG_CONFIG: remote_host=192.168.1.33 volumes: db_data:
- Save the following text to a ´~/dev /wordpress /website /docker /wordpress /Dockerfile´ file
FROM wordpress:4.7.3-php7.1-apache RUN yes | pecl install xdebug && echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini && echo "xdebug.remote_enable=on" >> /usr/local/etc/php/conf.d/xdebug.ini && echo "xdebug.remote_autostart=off" >> /usr/local/etc/php/conf.d/xdebug.ini
- Run everything: ´$ docker-compose up´
- Visit http://0.0.0.0:8000 and configure WordPress
Connect to the running dbms server from SequelPro
- Select the Standard tab
- Configure:
Name: Docker for WordPress Host: 0.0.0.0 Port: 32768 Username: wordpress Password: wordpress
- Connect
Connect to a running server from a terminal
Example relative to connecting to the running dbms server.
- Find out the name of the server:
$ docker-compose ps Name Command State Ports -------------------------------------------------------------------------------------- website_dbms_1 docker-entrypoint.sh mysqld Up 0.0.0.0:32768->3306/tcp website_wordpress_1 docker-entrypoint.sh apach ... Up 0.0.0.0:8000->80/tcp
- Connect to the ´website_dbms_1´ server:
$ docker exec -it website_dbms_1 bash root@7d36d19c7df4:/#
- Then, for example, find out the server IP:
root@7d36d19c7df4:/# hostname -I 172.18.0.2