---
title: "Run Grafana Alloy in a Podman container | Grafana Alloy documentation"
description: "Learn how to run Grafana Alloy in a Podman container"
---

# Run Grafana Alloy in a Podman container

Podman is a container engine that runs without a daemon for developing, managing, and running Open Container Initiative (OCI) containers. You can use Podman as a drop-in replacement for Docker to run Alloy.

Alloy is available as a Docker container image that you can use with Podman on the following platforms:

- Linux for AMD64 and ARM64.
- macOS for AMD64 (Intel) and ARM64 (Apple Silicon).
- Windows for AMD64.

> Note
> 
> On macOS and Windows, Podman runs containers in a Linux virtual machine managed by `podman machine`. The container commands are the same across all platforms once the machine is running.

## Before you begin

- Install [Podman](https://podman.io/) or [Podman Desktop](https://podman-desktop.io/) on your computer.
- On macOS or Windows, initialize and start the Podman machine:
  
  shell ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
  
  ```shell
  podman machine init
  podman machine start
  ```
- Create and save an Alloy configuration file on your computer, for example:
  
  Alloy ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
  
  ```alloy
  logging {
    level  = "info"
    format = "logfmt"
  }
  ```

## Run a rootless Podman container

One of the key features of Podman is the ability to run containers without root privileges. To run Alloy as a rootless Podman container, run the following command in a terminal window:

shell ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```shell
podman run \
  -v <CONFIG_FILE_PATH>:/etc/alloy/config.alloy:Z \
  -p 12345:12345 \
  docker.io/grafana/alloy:latest \
    run --server.http.listen-addr=0.0.0.0:12345 --storage.path=/var/lib/alloy/data \
    /etc/alloy/config.alloy
```

Replace the following:

- *`<CONFIG_FILE_PATH>`* : The absolute path of the configuration file on your host system.

> Note
> 
> The `:Z` suffix on the volume mount is required on Linux systems with Security-Enhanced Linux enabled (such as Fedora, RHEL, and CentOS) to set the correct security context for the mounted file.
> 
> If you’re running on macOS, Windows, or a Linux system without Security-Enhanced Linux, you can omit the `:Z` suffix.

You can modify the last line to change the arguments passed to the Alloy binary. Refer to the documentation for [run](../../../reference/cli/run/) for more information about the options available to the `run` command.

> Note
> 
> Make sure you pass `--server.http.listen-addr=0.0.0.0:12345` as an argument as shown in the example. If you don’t pass this argument, the \[debugging UI]\[UI] won’t be available outside of the Podman container.

## Run a Podman container with root privileges

If you need to run Alloy with root privileges, for example to access host-level resources, run the following command:

shell ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```shell
sudo podman run \
  -v <CONFIG_FILE_PATH>:/etc/alloy/config.alloy:Z \
  -p 12345:12345 \
  docker.io/grafana/alloy:latest \
    run --server.http.listen-addr=0.0.0.0:12345 --storage.path=/var/lib/alloy/data \
    /etc/alloy/config.alloy
```

Replace the following:

- *`<CONFIG_FILE_PATH>`* : The absolute path of the configuration file on your host system.

## Run with systemd integration on Linux

On Linux, Podman integrates with systemd to manage containers as services. To generate a systemd unit file for Alloy:

1. Run the container with a name:
   
   shell ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```shell
   podman run -d --name alloy \
     -v <CONFIG_FILE_PATH>:/etc/alloy/config.alloy:Z \
     -p 12345:12345 \
     docker.io/grafana/alloy:latest \
       run --server.http.listen-addr=0.0.0.0:12345 --storage.path=/var/lib/alloy/data \
       /etc/alloy/config.alloy
   ```
   
   Replace the following:
   
   - *`<CONFIG_FILE_PATH>`* : The absolute path of the configuration file on your host system.
2. Generate a systemd unit file:
   
   shell ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```shell
   podman generate systemd --name alloy --files --new
   ```
3. Move the generated file to the systemd directory:
   
   shell ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```shell
   mv container-alloy.service ~/.config/systemd/user/
   ```
4. Reload systemd and enable the service:
   
   shell ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```shell
   systemctl --user daemon-reload
   systemctl --user enable --now container-alloy.service
   ```

## Use Podman Compose

If you prefer using Compose files, Podman supports Docker Compose files through `podman-compose`.

1. Create a `compose.yaml` file:
   
   YAML ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```yaml
   services:
     alloy:
       image: docker.io/grafana/alloy:latest
       ports:
         - "12345:12345"
       volumes:
         - <CONFIG_FILE_PATH>:/etc/alloy/config.alloy:Z
       command:
         - run
         - --server.http.listen-addr=0.0.0.0:12345
         - --storage.path=/var/lib/alloy/data
         - /etc/alloy/config.alloy
   ```
   
   Replace the following:
   
   - *`<CONFIG_FILE_PATH>`* : The absolute path of the configuration file on your host system.
2. Run the container:
   
   shell ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```shell
   podman-compose up -d
   ```

## BoringCrypto images

> Note
> 
> BoringCrypto support is in *Public preview* and is only available on AMD64 and ARM64 platforms.

BoringCrypto images are published with every release starting with version 1.1:

- The current BoringCrypto image is published as `docker.io/grafana/alloy:boringcrypto`.
- A specific version of the BoringCrypto image is published as `docker.io/grafana/alloy:<VERSION>-boringcrypto`, such as `docker.io/grafana/alloy:v1.1.0-boringcrypto`.

## Verify

To verify that Alloy is running successfully, navigate to [http://localhost:12345](http://localhost:12345) and make sure the Alloy [UI](../../../troubleshoot/debug/) loads without error.

You can also check the container status:

shell ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```shell
podman ps
```

## Next steps

- [Configure Alloy](../../../configure/linux/)
