---
title: "Classic TYPO3 demo installation using Docker Compose"
manual: "TYPO3 Explained"
version: "main"
permalink: "https://docs.typo3.org/permalink/t3coreapi:docker-compose-typo3@main"
source: "Administration/Docker/DockerComposeDemo/Index.rst"
rendered: "2026-09-20T15:52:37+00:00"
---

# Classic TYPO3 demo installation using Docker Compose {#docker-compose-typo3}

> [!WARNING]
> This setup is intended for **local testing and learning**.

This guide shows how to run the same TYPO3 demo environment from the
[Classic TYPO3 demo installation using Docker only](https://docs.typo3.org/permalink/t3coreapi:classic-docker-installation@main) using **Docker Compose**.

Instead of running each container manually with `docker run`, we define the
entire setup in a single `docker-compose.yml` file. This makes it easier
to start, stop, and manage services as a group.

> [!TIP]
> New to Docker Compose? Start here:
> [Getting started with Docker Compose](https://docs.docker.com/compose/gettingstarted/).

**Table of contents**

-   [How to run TYPO3 with Docker Compose](https://docs.typo3.org/permalink/t3coreapi:how-to-run-typo3-with-docker-compose@main)
-   [About port mapping in Docker Compose](https://docs.typo3.org/permalink/t3coreapi:about-port-mapping-in-docker-compose@main)
-   [Stop and clean up](https://docs.typo3.org/permalink/t3coreapi:stop-and-clean-up@main)

## How to run TYPO3 with Docker Compose {#docker-compose-typo3-run-typo3-docker}

### Create a project directory {#docker-compose-create-project}

**$**

```bash
mkdir compose_demo_typo3
cd compose_demo_typo3
mkdir -p fileadmin typo3conf typo3temp

# Linux/WSL only (fix permissions during development)
# chmod -R 777 fileadmin typo3conf typo3temp
# sudo chown -R 33:33 fileadmin typo3conf typo3temp
```

### Create the docker-compose.yml file {#docker-compose-create-composefile}

**docker-compose.yml**

```yaml
services:
  db:
    image: mariadb:10.6
    container_name: compose-demo-typo3db
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: db
      MYSQL_USER: db
      MYSQL_PASSWORD: db
    volumes:
      - db_data:/var/lib/mysql

  web:
    image: martinhelmich/typo3:latest
    container_name: compose-demo-typo3
    # Using linux? Uncomment the line below and use CURRENT_UID=$(id -u):$(id -g) docker-compose up to run
    # user: ${CURRENT_UID}
    ports:
      - "8081:80"
    depends_on:
      - db
    volumes:
      - ./fileadmin:/var/www/html/fileadmin
      - ./typo3conf:/var/www/html/typo3conf
      - ./typo3temp:/var/www/html/typo3temp

volumes:
  db_data:

```

### Start the environment {#docker-compose-start-environment}

```bash
docker compose up -d
```

### Open TYPO3 in your browser {#docker-compose-open-in-browser}

Visit:

```text
http://localhost:8081
```

(This URL works because port 8081 on your host maps to port 80 in the container;
see [About port mapping in Docker Compose](https://docs.typo3.org/permalink/t3coreapi:docker-compose-port-mapping@main))

Use these installer settings:

-   **Database host**: `db`
-   **Username**: `db`
-   **Password**: `db`
-   **Database name**: `db`

## About port mapping in Docker Compose {#docker-compose-port-mapping}

By default, the TYPO3 container exposes **port 80** internally. In the
`docker-compose.yml` file, this is mapped to a port on your local machine
using the `ports` option:

```yaml
ports:
  - "8081:80"
```

This means:

-   `80` is the container’s internal web server port
-   `8081` is the port on your local machine

With this mapping, you can access TYPO3 at:

```text
http://localhost:8081
```

You can change the `8081` part to any available port above `1024`, if needed.
The internal port `80` should not be changed, as it is required by the webserver
in the TYPO3 image.

> [!TIP]
> Learn more: [Docker Compose Networking – Ports](https://docs.docker.com/compose/compose-file/#ports)

## Stop and clean up {#docker-compose-stop-cleanup}

To stop all containers:

```bash
docker compose down
```

To also remove volumes (e.g. the database):

```bash
docker compose down --volumes
```

> [!NOTE]
> **See also**
>
> If you encounter file permission issues, see [Solving file permission issues](https://docs.typo3.org/permalink/t3coreapi:classic-docker-permissions@main).
