A [Fabric server](https://fabricmc.net/) can be automatically downloaded, upgraded, and run by setting the environment variable TYPE to "FABRIC"

!!! example

    Using `docker run` command line

    ```shell
    docker run -d --pull=always -e EULA=TRUE -e TYPE=FABRIC -p 25565:25565 itzg/minecraft-server
    ```
    
    In a compose file service:
    
    ```yaml
    environment:
      EULA: TRUE
      TYPE: FABRIC
    ```

By default, the container will install the latest [fabric server launcher](https://fabricmc.net/use/server/), using the latest [fabric-loader](https://fabricmc.net/wiki/documentation:fabric_loader) against the minecraft version you have defined with `VERSION` (defaulting to the latest vanilla release of the game).

A specific loader or launcher version other than the latest can be requested using `FABRIC_LOADER_VERSION` and `FABRIC_LAUNCHER_VERSION` respectively, such as:

!!! example "Using launcher and loader versions"

    With docker run

    ```shell
    docker run -d ... \
        -e TYPE=FABRIC \
        -e FABRIC_LAUNCHER_VERSION=0.10.2 \
        -e FABRIC_LOADER_VERSION=0.13.1
    ```
    
    In a compose file service:
    
    ```yaml
    environment:
      EULA: TRUE
      TYPE: FABRIC
      FABRIC_LAUNCHER_VERSION: 0.10.2
      FABRIC_LOADER_VERSION: 0.13.1
    ```

The container fetches Fabric loader and game version metadata from the [Fabric meta API](https://meta.fabricmc.net). You can override the base URL with `FABRIC_META_BASE_URL` (default: `https://meta.fabricmc.net`), for example when using a mirror or custom meta endpoint.

!!! note

    See the [Working with mods and plugins](../../mods-and-plugins/index.md) section to set up Fabric mods and configuration.

## Fabric API

As [mentioned on the Fabric download page](https://fabricmc.net/use/installer/), most mods will require the Fabric API mod to be installed. That can be easily done by utilizing [the Modrinth downloads feature](../../mods-and-plugins/modrinth.md), such as adding this to the `environment` of a compose file service:

```yaml
      TYPE: FABRIC
      MODRINTH_PROJECTS: |
        fabric-api
```

## Alternate launcher

If you wish to use an alternative launcher you can:  

- Provide the path to a custom launcher jar available to the container with `FABRIC_LAUNCHER`, relative to `/data` (such as `-e FABRIC_LAUNCHER=fabric-server-custom.jar`)
- Provide the URL to a custom launcher jar with `FABRIC_LAUNCHER_URL` (such as `-e FABRIC_LAUNCHER_URL=http://HOST/fabric-server-custom.jar`)

## Force re-install

If the Fabric launcher jar becomes corrupted you can temporarily set FABRIC_FORCE_REINSTALL to "true" to have it re-installed on next startup.