{"id":1,"date":"2023-12-12T10:41:35","date_gmt":"2023-12-12T10:41:35","guid":{"rendered":"http:\/\/blog.200oksolutions.com\/?p=1"},"modified":"2025-12-04T07:44:09","modified_gmt":"2025-12-04T07:44:09","slug":"dockerize-your-laravel-application","status":"publish","type":"post","link":"https:\/\/www.200oksolutions.com\/blog\/dockerize-your-laravel-application\/","title":{"rendered":"Dockerize Your Laravel Application"},"content":{"rendered":"\n<p>How to Install Laravel with Docker<\/p>\n\n\n\n<p>Before we dive into the installation steps, make sure you have the necessary system requirements and Windows edition to run Docker Desktop. Here&#8217;s a simplified guide to get Laravel up and running with Docker.<\/p>\n\n\n\n<p><strong>System Requirements<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Windows 11 (64-bit): Home or Pro version 21H2 or higher, or Enterprise or Education version 21H2 or higher.<\/li>\n\n\n\n<li>Windows 10 (64-bit): Home or Pro 21H2 (build 19045) or higher, or Enterprise or Education 21H2 (build 19045) or higher.<\/li>\n\n\n\n<li>Ensure WSL 2 (Windows Subsystem for Linux 2) is enabled on Windows. Refer to Microsoft&#8217;s documentation for instructions.<\/li>\n<\/ul>\n\n\n\n<p><strong>Hardware Prerequisites<\/strong><\/p>\n\n\n\n<p>For Windows 10 or 11, you&#8217;ll need:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>64-bit processor with Second Level Address Translation (SLAT)<\/li>\n\n\n\n<li>4GB system RAM<\/li>\n\n\n\n<li>BIOS-level hardware virtualization support enabled<\/li>\n<\/ul>\n\n\n\n<p><strong>Important Note<\/strong><\/p>\n\n\n\n<p>Running Windows containers requires Windows 10 or 11 Professional or Enterprise edition. Windows Home or Education editions only support Linux containers.<\/p>\n\n\n\n<p><strong>Installation Steps<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Download Docker Desktop<\/strong>&nbsp;for Windows from their official website.<\/li>\n\n\n\n<li>Run the installer by double-clicking on &#8220;Docker Desktop Installer.exe.&#8221;<\/li>\n\n\n\n<li>During installation, select the &#8220;Use WSL 2 instead of Hyper-V&#8221; option if available.\n<ul class=\"wp-block-list\">\n<li>Note: If your system supports only one option, you won&#8217;t have a choice in the backend.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Follow the installation wizard&#8217;s instructions to authorize the installer and complete the process.<\/li>\n\n\n\n<li>After successful installation, select &#8220;Close.&#8221; Docker will ask you to log out and back into your Windows session or restart your machine to finish the installation.<\/li>\n<\/ol>\n\n\n\n<p><strong>Starting Docker Desktop<\/strong><\/p>\n\n\n\n<p>After the restart:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Start Docker Desktop by searching for it in the start menu.<\/li>\n\n\n\n<li>The first time you run Docker, it may take a few minutes to configure itself.<\/li>\n\n\n\n<li>Open a command prompt or PowerShell window.<\/li>\n\n\n\n<li>Run the command&nbsp;<code>docker --version<\/code>&nbsp;to ensure Docker is installed and running.<\/li>\n<\/ol>\n\n\n\n<p><strong>Setting Up Laravel with Docker<\/strong><\/p>\n\n\n\n<p><strong>Dockerfile<\/strong><\/p>\n\n\n\n<p>Create a Dockerfile in your Laravel project&#8217;s root directory with the following content:<\/p>\n\n\n\n<pre class=\"wp-block-code has-black-color has-silver-blue-background-color has-text-color has-background has-link-color wp-elements-ad3c56ab1a8d28e7e6bb8dbcb9c6c095\"><code>FROM php:8.1.0-apache\n\nWORKDIR \/var\/www\/html\n\n# Install required dependencies\nRUN a2enmod rewrite\nRUN apt-get update &amp;&amp; apt-get -y install gcc mono-mcs &amp;&amp; rm -rf \/var\/lib\/apt\/lists\/*\nRUN apt-get update -y &amp;&amp; apt-get install -y libicu-dev libmariadb-dev unzip zip zlib1g-dev libpng-dev libjpeg-dev libfreetype6-dev libjpeg62-turbo-dev libpng-dev default-libmysqlclient-dev gcc\nRUN apt-get -y update; apt-get -y install curl\n\n# Install Composer\nCOPY --from=composer:latest \/usr\/bin\/composer \/usr\/bin\/composer\n\n# Install PHP extensions\nRUN docker-php-ext-install gettext intl pdo_mysql gd\nRUN docker-php-ext-configure gd --enable-gd --with-freetype --with-jpeg &amp;&amp; docker-php-ext-install -j$(nproc) gd\n<\/code><\/pre>\n\n\n\n<p><strong>docker-compose.yml<\/strong><\/p>\n\n\n\n<p>Create a docker-compose.yml file in your Laravel project&#8217;s root directory:<\/p>\n\n\n\n<pre class=\"wp-block-code has-black-color has-silver-blue-background-color has-text-color has-background has-link-color wp-elements-557b5c0abbc87018a45c5521c5ea5329\"><code>services:\n  laravel-docker:\n    container_name: laravel-docker\n    build: .\n    volumes:\n      - .\/laravel-app:\/var\/www\/html\n    ports:\n      - 9000:80\n    extra_hosts:\n      - \"192.168.0.188:9000\"\n\n  mysql_db:\n    image: mysql:latest\n    environment:\n      MYSQL_ROOT_PASSWORD: root\n      MYSQL_DATABASE: laravel_docker\n    ports:\n    - 3306:3306\n\n  phpmyadmin:\n    image: phpmyadmin:latest\n    ports:\n      - 9001:80\n    environment:\n      - PMA_ARBITRARY=1\n<\/code><\/pre>\n\n\n\n<p><strong>Running Docker Containers<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Navigate to your Laravel project&#8217;s base directory in the command prompt.<\/li>\n\n\n\n<li>Execute\u00a0<code><strong>docker-compose build<\/strong><\/code>\u00a0to build the Docker containers.<\/li>\n\n\n\n<li>Launch the application with\u00a0<strong><code>docker-compose up<\/code>.<\/strong><\/li>\n\n\n\n<li>Access the Docker container with\u00a0<code><strong>docker exec -it laravel-docker bash<\/strong><\/code>. Replace &#8220;laravel-docker&#8221; with your container&#8217;s name if different.<\/li>\n<\/ol>\n\n\n\n<p><strong>Install Laravel and Configure Database<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\" start=\"5\">\n<li>Install Laravel using the command:\u00a0<code><strong>composer create-project laravel\/laravel .<\/strong><\/code><\/li>\n\n\n\n<li>Once Laravel is installed, execute the\u00a0<code><strong>exit<\/strong><\/code>\u00a0command.<\/li>\n<\/ol>\n\n\n\n<p><strong>Modify the .env File<\/strong><\/p>\n\n\n\n<p>Update the database connection details in the .env file with these settings:<\/p>\n\n\n\n<pre class=\"wp-block-code has-black-color has-silver-blue-background-color has-text-color has-background has-link-color wp-elements-0297a36262470d10e2dd29d5e0a18fd5\"><code>DB_CONNECTION=mysql\nDB_HOST=mysql_db\nDB_PORT=3306\nDB_DATABASE=laravel_docker\nDB_USERNAME=root\nDB_PASSWORD=root\n<\/code><\/pre>\n\n\n\n<p><strong>Execute Migrations<\/strong><\/p>\n\n\n\n<p>Run the migrations using the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code has-black-color has-silver-blue-background-color has-text-color has-background has-link-color wp-elements-8f45fa5340c4abe4aae06949762e3d43\"><code>docker exec laravel-docker bash -c \"php artisan migrate\"\n<\/code><\/pre>\n\n\n\n<p>Now, your Laravel project should be accessible at&nbsp;<a href=\"http:\/\/localhost:9000\/public\/\">http:\/\/localhost:9000\/public\/<\/a>, and you can manage your database with PHPMyAdmin at&nbsp;<a href=\"http:\/\/localhost:9001\/\">http:\/\/localhost:9001\/<\/a>. Enjoy developing with Laravel and Docker!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to Install Laravel with Docker Before we dive into the installation steps, make sure you have&hellip;<\/p>\n","protected":false},"author":5,"featured_media":14,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Dockerize Your Laravel Application Web Development, Software, and App Blog | 200OK Solutions<\/title>\n<meta name=\"description\" content=\"Explore the 200OK Blog \u2013 your go-to source for insights on web development, backend architecture, API design, and tech best practices from industry professionals.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.200oksolutions.com\/blog\/dockerize-your-laravel-application\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Dockerize Your Laravel Application Web Development, Software, and App Blog | 200OK Solutions\" \/>\n<meta property=\"og:description\" content=\"Explore the 200OK Blog \u2013 your go-to source for insights on web development, backend architecture, API design, and tech best practices from industry professionals.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.200oksolutions.com\/blog\/dockerize-your-laravel-application\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Development, Software, and App Blog | 200OK Solutions\" \/>\n<meta property=\"article:published_time\" content=\"2023-12-12T10:41:35+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-12-04T07:44:09+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.200oksolutions.com\/blog\/wp-content\/uploads\/2023\/12\/Docker-Laravel.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"900\" \/>\n\t<meta property=\"og:image:height\" content=\"866\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Piyush Solanki\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Piyush Solanki\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Dockerize Your Laravel Application Web Development, Software, and App Blog | 200OK Solutions","description":"Explore the 200OK Blog \u2013 your go-to source for insights on web development, backend architecture, API design, and tech best practices from industry professionals.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.200oksolutions.com\/blog\/dockerize-your-laravel-application\/","og_locale":"en_US","og_type":"article","og_title":"Dockerize Your Laravel Application Web Development, Software, and App Blog | 200OK Solutions","og_description":"Explore the 200OK Blog \u2013 your go-to source for insights on web development, backend architecture, API design, and tech best practices from industry professionals.","og_url":"https:\/\/www.200oksolutions.com\/blog\/dockerize-your-laravel-application\/","og_site_name":"Web Development, Software, and App Blog | 200OK Solutions","article_published_time":"2023-12-12T10:41:35+00:00","article_modified_time":"2025-12-04T07:44:09+00:00","og_image":[{"width":900,"height":866,"url":"https:\/\/www.200oksolutions.com\/blog\/wp-content\/uploads\/2023\/12\/Docker-Laravel.jpg","type":"image\/jpeg"}],"author":"Piyush Solanki","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Piyush Solanki","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.200oksolutions.com\/blog\/dockerize-your-laravel-application\/#article","isPartOf":{"@id":"https:\/\/www.200oksolutions.com\/blog\/dockerize-your-laravel-application\/"},"author":{"name":"Piyush Solanki","@id":"https:\/\/www.200oksolutions.com\/blog\/#\/schema\/person\/e07f6b8e3c9a90ce7b3b09427d26155e"},"headline":"Dockerize Your Laravel Application","datePublished":"2023-12-12T10:41:35+00:00","dateModified":"2025-12-04T07:44:09+00:00","mainEntityOfPage":{"@id":"https:\/\/www.200oksolutions.com\/blog\/dockerize-your-laravel-application\/"},"wordCount":430,"commentCount":0,"publisher":{"@id":"https:\/\/www.200oksolutions.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.200oksolutions.com\/blog\/dockerize-your-laravel-application\/#primaryimage"},"thumbnailUrl":"https:\/\/www.200oksolutions.com\/blog\/wp-content\/uploads\/2023\/12\/Docker-Laravel.jpg","articleSection":["PHP"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.200oksolutions.com\/blog\/dockerize-your-laravel-application\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.200oksolutions.com\/blog\/dockerize-your-laravel-application\/","url":"https:\/\/www.200oksolutions.com\/blog\/dockerize-your-laravel-application\/","name":"Dockerize Your Laravel Application Web Development, Software, and App Blog | 200OK Solutions","isPartOf":{"@id":"https:\/\/www.200oksolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.200oksolutions.com\/blog\/dockerize-your-laravel-application\/#primaryimage"},"image":{"@id":"https:\/\/www.200oksolutions.com\/blog\/dockerize-your-laravel-application\/#primaryimage"},"thumbnailUrl":"https:\/\/www.200oksolutions.com\/blog\/wp-content\/uploads\/2023\/12\/Docker-Laravel.jpg","datePublished":"2023-12-12T10:41:35+00:00","dateModified":"2025-12-04T07:44:09+00:00","description":"Explore the 200OK Blog \u2013 your go-to source for insights on web development, backend architecture, API design, and tech best practices from industry professionals.","breadcrumb":{"@id":"https:\/\/www.200oksolutions.com\/blog\/dockerize-your-laravel-application\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.200oksolutions.com\/blog\/dockerize-your-laravel-application\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.200oksolutions.com\/blog\/dockerize-your-laravel-application\/#primaryimage","url":"https:\/\/www.200oksolutions.com\/blog\/wp-content\/uploads\/2023\/12\/Docker-Laravel.jpg","contentUrl":"https:\/\/www.200oksolutions.com\/blog\/wp-content\/uploads\/2023\/12\/Docker-Laravel.jpg","width":900,"height":866},{"@type":"BreadcrumbList","@id":"https:\/\/www.200oksolutions.com\/blog\/dockerize-your-laravel-application\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.200oksolutions.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Dockerize Your Laravel Application"}]},{"@type":"WebSite","@id":"https:\/\/www.200oksolutions.com\/blog\/#website","url":"https:\/\/www.200oksolutions.com\/blog\/","name":"Web Development, Software, and App Blog | 200OK Solutions","description":"","publisher":{"@id":"https:\/\/www.200oksolutions.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.200oksolutions.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.200oksolutions.com\/blog\/#organization","name":"Web Development Blog | Software Blog | App Blog","url":"https:\/\/www.200oksolutions.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.200oksolutions.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/200oksolutions.com\/blog\/wp-content\/uploads\/2025\/09\/200ok_logo-CGzMrWDu.png","contentUrl":"https:\/\/200oksolutions.com\/blog\/wp-content\/uploads\/2025\/09\/200ok_logo-CGzMrWDu.png","width":500,"height":191,"caption":"Web Development Blog | Software Blog | App Blog"},"image":{"@id":"https:\/\/www.200oksolutions.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.instagram.com\/200ok_solutions\/"]},{"@type":"Person","@id":"https:\/\/www.200oksolutions.com\/blog\/#\/schema\/person\/e07f6b8e3c9a90ce7b3b09427d26155e","name":"Piyush Solanki","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.200oksolutions.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/962a2b0b4db856e6851ec7d838597a0395adcaae9c0091d223de9942a4254461?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/962a2b0b4db856e6851ec7d838597a0395adcaae9c0091d223de9942a4254461?s=96&d=mm&r=g","caption":"Piyush Solanki"},"description":"Piyush is a seasoned PHP Tech Lead with 10+ years of experience architecting and delivering scalable web and mobile backend solutions for global brands and fast-growing SMEs. He specializes in PHP, MySQL, CodeIgniter, WordPress, and custom API development, helping businesses modernize legacy systems and launch secure, high-performance digital products. He collaborates closely with mobile teams building Android &amp; iOS apps , developing RESTful APIs, cloud integrations, and secure payment systems using platforms like Stripe, AWS S3, and OTP\/SMS gateways. His work extends across CMS customization, microservices-ready backend architectures, and smooth product deployments across Linux and cloud-based environments. Piyush also has a strong understanding of modern front-end technologies such as React and TypeScript, enabling him to contribute to full-stack development workflows and advanced admin panels. With a successful delivery track record in the UK market and experience building digital products for sectors like finance, hospitality, retail, consulting, and food services, Piyush is passionate about helping SMEs scale technology teams, improve operational efficiency, and accelerate innovation through backend excellence and digital tools.","url":"https:\/\/www.200oksolutions.com\/blog\/author\/piyush\/"}]}},"_links":{"self":[{"href":"https:\/\/www.200oksolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.200oksolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.200oksolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.200oksolutions.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.200oksolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=1"}],"version-history":[{"count":4,"href":"https:\/\/www.200oksolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1\/revisions"}],"predecessor-version":[{"id":885,"href":"https:\/\/www.200oksolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1\/revisions\/885"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.200oksolutions.com\/blog\/wp-json\/wp\/v2\/media\/14"}],"wp:attachment":[{"href":"https:\/\/www.200oksolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=1"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.200oksolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=1"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.200oksolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=1"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}