Skip to navigation
Complete guide for installing Bedrock with Docker
28.10.26
### How to Install Bedrock with Docker To install Bedrock using Docker, the most efficient way is to use **Docker Compose**. This allows you to define both your WordPress application (Bedrock) and your database (MariaDB) in a single configuration. #### 1. Prerequisites * [Docker Desktop](https://www.docker.com/products/docker-desktop/) installed. * [Composer](https://getcomposer.org/) installed on your local machine. #### 2. Initialize the Bedrock Project Open your terminal and run: ```bash composer create-project roots/bedrock my-site cd my-site ``` #### 3. Create a `docker-compose.yml` file Create a file named `docker-compose.yml` in your root directory: ```yaml version: '3.8' services: db: image: mariadb:10.6 restart: always environment: MYSQL_DATABASE: wordpress MYSQL_USER: wordpress MYSQL_PASSWORD: password MYSQL_ROOT_PASSWORD: rootpassword volumes: - db_data:/var/lib/mysql wordpress: build: . restart: always ports: - "8080:80" environment: DB_HOST: db DB_NAME: wordpress DB_USER: wordpress DB_PASSWORD: password WP_ENV: development WP_HOME: http://localhost:8080 WP_SITEURL: http://localhost:8080/wp depends_on: - db volumes: db_data: ``` #### 4. Create a `Dockerfile` Create a file named `Dockerfile` in the same directory: ```dockerfile FROM php:8.2-apache RUN apt-get update && apt-get install -y \ libpng-dev libjpeg-dev libzip-dev zip unzip \ && docker-php-ext-configure gd --with-jpeg \ && docker-php-ext-install pdo_mysql mysqli gd zip RUN a2enmod rewrite ENV APACHE_DOCUMENT_ROOT /var/www/html/web RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf COPY . /var/www/html/ WORKDIR /var/www/html ``` #### 5. Configure `.env` Copy the example file and update it: ```bash cp .env.example .env ``` Open `.env` and set these values: ```text DB_HOST=db DB_NAME=wordpress DB_USER=wordpress DB_PASSWORD=password WP_HOME=http://localhost:8080 WP_SITEURL=http://localhost:8080/wp ``` #### 6. Start the Containers Run the following command: ```bash docker-compose up -d ``` You can now access your site at `http://localhost:8080`. *** **Does this format work better for your needs?**
Reply
Anonymous
Information Epoch 1793285726
A language that doesn't affect the way you think is not worth knowing.
Home
Notebook
Contact us