# Via Docker Compose

{% hint style="info" %}
This guide assumes you already have [Docker ](https://www.docker.com/)installed.
{% endhint %}

{% hint style="info" %}
This Docker compose creates two services:&#x20;

1. **Webserver** (Apache/PHP)  - The [UXWizz Webserver image](https://hub.docker.com/repository/docker/uxwizz/uxwizz-webserver/general)
2. **Database** (MySQL) - [MariaDB Image](https://hub.docker.com/_/mariadb)
   {% endhint %}

## Running UXWizz via docker compose

Copy this **compose.yml**  file locally in a folder named `uxwizz` and run **`docker compose up -d`**

{% code title="compose.yml" %}

```yaml
services:
  webserver:
    image: uxwizz/uxwizz-webserver:latest
    container_name: "uxwizz-webserver"
    restart: always
    ports:
      - "8000:80"
      - "4430:443"
    volumes:
      - html:/var/www/html
      - php-config:/usr/local/etc/php/php.ini
      - apache_sites_enabled:/etc/apache2/sites-enabled
      - apache_logs:/var/log/apache2
    environment:
      UXWIZZ_DB_HOST: db
      MYSQL_DATABASE: uxwizz
      MYSQL_ROOT_PASSWORD: temp-root-password-jasdlkz1
    depends_on:
      db:
        condition: service_healthy
  db:
    image: mariadb:11.7.2
    container_name: "uxwizz-db"
    ports:
      - "3306:3306"
    command: --max-allowed-packet=64MB --bind-address=0.0.0.0
    environment:
      MYSQL_ROOT_PASSWORD: temp-root-password-jasdlkz1
      MYSQL_DATABASE: uxwizz
      MARIADB_AUTO_UPGRADE: 1
      MARIADB_INITDB_SKIP_TZINFO: 1
    volumes:
      - mysql_data:/var/lib/mysql
    healthcheck:
      test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
      start_period: 10s
      interval: 10s
      timeout: 5s
      retries: 3
    restart: always
volumes:
  mysql_data:
  html:
  apache_logs:
  apache_sites_enabled:
  php-config:

```

{% endcode %}

{% hint style="warning" %}
It is recommended to replace both values of **MYSQL\_ROOT\_PASSWORD** with a secure password.
{% endhint %}

To **stop** the services, you can run `docker compose down`.

To also **delete** all UXWizz data/db/volumes, you can run `docker compose down -v`.

## Accessing UXWizz

As shown in the compose file, the ports exported are **8000** (HTTP) and **4430** (HTTPS).\
\
You should now be able to access your dashboard at [**http://localhost:8000**](http://localhost:8000)

## Tip: Using Bind Volumes

If you want to use local folders as bind volumes, instead of named volumes.

You must first populate the **html** folder from the webserver image, by running this command:

```sh
mkdir -p ./html; docker run --rm --entrypoint="" uxwizz/uxwizz-webserver \
tar cf - -C /var/www/html . | tar xf - -C ./html
```

Then, in **compose.yml** prepend **./** to all volumes, like this:

```yaml
services:
...
  webserver:
  ...
    volumes:
      - ./html:/var/www/html
      - ./php.ini:/usr/local/etc/php/php.ini:ro
      - ./sites-enabled:/etc/apache2/sites-enabled
      - ./apache_logs:/var/log/apache2
  db:
  ...
    volumes:
      - ./mysql_data:/var/lib/mysql

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.uxwizz.com/installation/docker/via-docker-compose.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
