{
    "componentChunkName": "component---src-templates-blog-post-js",
    "path": "/docker-wordpress-setup-with-mysql-phpmyadmin/",
    "result": {"data":{"site":{"siteMetadata":{"title":"CrewCode Solutions"}},"markdownRemark":{"id":"43e66af1-2091-5ed9-98ad-83c6da548d47","excerpt":"In this article i will explain you step by step to dockerize your Wordpress application with mysql and phpmyadmin and create wordpress docker project We need to…","html":"<p>In this article i will explain you step by step to dockerize your Wordpress application with mysql and phpmyadmin and create wordpress docker project</p>\n<p>We need to create three Application container db, phpmyadmin and wordpress</p>\n<h4>Step 1: Create docker-compose.yaml file at the root path of your project</h4>\n<p><img src=\"https://crew-code-images.s3.us-east-1.amazonaws.com/blog_images/Wordpress-setup-mysql-phpmyadmin-1.png\" alt=\"create-docker-compose\"></p>\n<h4>Step 2: Add db container as a service inside docker-compose.yaml file</h4>\n<p>Copy paste following code inside your docker-compose.yaml file <strong><em>to add db container</em></strong>\nMYSQL_USER and MYSQL_PASSWORD is the username and password to authenticate the database and we have created this container under dockerwp network, restart:always parameter Restarts all stopped and running services. If you make changes to your docker-compose.yml</p>\n<pre><code class=\"language-js\">version: \"3.9\"\nservices:\n  # Database\n  db:\n    image: mysql:5.7\n    volumes:\n      - db_data:/var/lib/mysql\n    restart: always\n    environment:\n      MYSQL_ROOT_PASSWORD: password\n      MYSQL_DATABASE: wordpress\n      MYSQL_USER: wordpress\n      MYSQL_PASSWORD: wordpress\n    networks:\n      - dockerwp\n</code></pre>\n<h4>Step 3: Add phpmyadmin container as a service inside docker-compose.yaml file</h4>\n<p>Copy paste following code inside your docker-compose.yaml file <strong><em>to add phpmyadmin container</em></strong></p>\n<pre><code class=\"language-js\">version: \"3.9\"\nservices:\n  # Database\n  db:\n    image: mysql:5.7\n    volumes:\n      - db_data:/var/lib/mysql\n    restart: always\n    environment:\n      MYSQL_ROOT_PASSWORD: password\n      MYSQL_DATABASE: wordpress\n      MYSQL_USER: wordpress\n      MYSQL_PASSWORD: wordpress\n    networks:\n      - dockerwp\n  # phpmyadmin\n  phpmyadmin:\n    depends_on:\n      - db\n    image: phpmyadmin\n    restart: always\n    ports:\n      - \"8080:80\"\n    environment:\n      PMA_HOST: db\n      MYSQL_ROOT_PASSWORD: password\n    networks:\n      - dockerwp\n</code></pre>\n<h4>Step 4: Add wordpress container as a service and volumes inside docker-compose.yaml file</h4>\n<p>Copy paste following code inside your docker-compose.yaml file <strong><em>to add wordpress container</em></strong> <strong><em>and this completes your docker-compose.yaml file</em></strong></p>\n<pre><code class=\"language-js\">version: \"3.9\"\nservices:\n  # Database\n  db:\n    image: mysql:5.7\n    volumes:\n      - db_data:/var/lib/mysql\n    restart: always\n    environment:\n      MYSQL_ROOT_PASSWORD: password\n      MYSQL_DATABASE: wordpress\n      MYSQL_USER: wordpress\n      MYSQL_PASSWORD: wordpress\n    networks:\n      - dockerwp\n  # phpmyadmin\n  phpmyadmin:\n    depends_on:\n      - db\n    image: phpmyadmin\n    restart: always\n    ports:\n      - \"8080:80\"\n    environment:\n      PMA_HOST: db\n      MYSQL_ROOT_PASSWORD: password\n    networks:\n      - dockerwp\n  # Wordpress\n  wordpress:\n    depends_on:\n      - db\n    image: wordpress:latest\n    volumes:\n      - wordpress_data:/var/www/html\n      - ./src:/var/www/html\n    ports:\n      - \"8000:80\"\n    restart: always\n    environment:\n      WORDPRESS_DB_HOST: db\n      WORDPRESS_DB_USER: wordpress\n      WORDPRESS_DB_PASSWORD: wordpress\n      WORDPRESS_DB_NAME: wordpress\n    networks:\n      - dockerwp\nnetworks:\n  dockerwp:\nvolumes:\n  db_data: {}\n  wordpress_data: {}\n</code></pre>\n<h4>Step 5: Run docker, run wordpress and phpmyadmin</h4>\n<p>Make sure <strong><em>your docker is running</em></strong> then <strong><em>copy below command and open terminal and go to your docker folder</em></strong> where docker-compose.yaml file is kept and run the command</p>\n<pre><code class=\"language-js\">  docker-compose up -d\n</code></pre>\n<p>this will start the docker in detached mode once your docker is running you can <strong><em>go to browser and run the url <a href=\"http://localhost:8000\">http://localhost:8000</a></em></strong> this is for wordpress it will ask you to install the wordpress follow the installation steps</p>\n<p>After you have completed the wordpress installation and you are logged in <strong><em>open url <a href=\"http://localhost:8080\">http://localhost:8080</a></em></strong> this is for phpmyadmin and <strong><em>make sure to use the username and password MYSQL_USER: wordpress, MYSQL_PASSWORD: wordpress, to login</em></strong></p>","fields":{"slug":"/docker-wordpress-setup-with-mysql-phpmyadmin/"},"frontmatter":{"title":"Wordpress setup with MySql and PhpMyAdmin using docker | Docker wordpress tutorial","date":"August 10, 2022","description":"In this article i will explain you step by step to do wordpress setup with mysql and phpmyadmin using docker, this is small docker wordpress tutorial to explain you about creating wordpress docker project","bannerimage":"https://crew-code-images.s3.us-east-1.amazonaws.com/blog_images/WordpressDocker.jpg"}},"previous":{"fields":{"slug":"/docker-setup-for-laravel-application/"},"frontmatter":{"title":"Docker setup for Laravel application","date":"August 01, 2022","bannerimage":"https://crew-code-images.s3.us-east-1.amazonaws.com/blog_images/docker.jpg"}},"next":{"fields":{"slug":"/email-authentication-flutter-firebase/"},"frontmatter":{"title":"Email authentication with firebase in flutter android and ios","date":"August 30, 2022","bannerimage":"https://crew-code-images.s3.us-east-1.amazonaws.com/blog_images/email-authentication-firebase.jpeg"}}},"pageContext":{"id":"43e66af1-2091-5ed9-98ad-83c6da548d47","previousPostId":"770d20bd-f14d-5c05-9bbd-1b714b97f518","nextPostId":"b99f15e4-45cb-5600-8953-203980b1866c"}},
    "staticQueryHashes": ["3860684146"]}