Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

stratboy's avatar

Herd vs Docker?

Hi, and now, after homestead, valet and docker, there's Herd. :) Every time I start to study Laravel again, I find another development environment in docs. So, in the end, what do you recommend for development nowadays?

0 likes
6 replies
LaryAI's avatar
Level 58

Both Herd and Docker are popular choices for development environments, but they have different approaches and use cases.

Herd is a Laravel-specific development environment that aims to simplify the setup and management of local development environments. It provides a consistent environment across different machines and allows for easy sharing of development environments with teammates. Herd uses Laravel's Sail package, which is a lightweight Docker setup specifically designed for Laravel applications.

On the other hand, Docker is a more general-purpose containerization platform that allows you to package applications and their dependencies into containers. Docker provides a consistent environment for running applications across different machines and operating systems. It is not Laravel-specific but can be used with any programming language or framework.

The choice between Herd and Docker depends on your specific needs and preferences. If you are primarily working with Laravel and want a simple and Laravel-specific development environment, Herd can be a good choice. It provides a streamlined setup process and integrates well with Laravel's ecosystem.

If you are working with multiple programming languages or frameworks, or if you prefer a more general-purpose containerization solution, Docker might be a better fit. Docker has a larger community and ecosystem, and it can be used for a wide range of applications beyond Laravel.

Ultimately, the choice between Herd and Docker depends on your specific requirements and familiarity with the tools. It can be helpful to try out both options and see which one works best for your workflow.

# Example Dockerfile for a Laravel application
FROM php:7.4-fpm

# Install dependencies
RUN apt-get update && apt-get install -y \
    git \
    curl \
    libpng-dev \
    libonig-dev \
    libxml2-dev \
    zip \
    unzip

# Install PHP extensions
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd

# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

# Set working directory
WORKDIR /var/www/html

# Copy project files
COPY . .

# Install project dependencies
RUN composer install --optimize-autoloader --no-dev

# Set permissions
RUN chown -R www-data:www-data /var/www/html/storage

# Expose port
EXPOSE 9000

# Start PHP-FPM
CMD ["php-fpm"]

This is just an example Dockerfile for a Laravel application. You would need to customize it based on your specific requirements and project structure.

Tray2's avatar
Tray2
Best Answer
Level 73

It all depends on your environment AKA Operating system, and your needs

If you are on a Mac, I would recommend using Valet or Herd.

If you are on a Windows PC, I would suggest either Laravel Sail, or a virtual machine with a lemp or lamp stack,

If you are on Linux, I would recommend, either hosting it locally with a lemp or lamp stack, or using Laravel Sail.

2 likes
stratboy's avatar

@Tray2 but will herd take care of installing and running things like databases, Redis cache, a mail server, etc? Or shoud I install them on my system? (by the way, macos).

Snapey's avatar

@stratboy It only includes the web server and php. How you setup the database and other services is up to you.

1 like
Tray2's avatar

@stratboy Sounds to me like you are looking for more of a "prod" server rather then a simple dev server. In that case I would go with Sail. I try to keep my wow kiss.

1 like

Please or to participate in this conversation.