Menu
Open source

Run Grafana Alloy in a Docker container

Alloy is available as a Docker container image on the following platforms:

Before you begin

  • Install Docker on your computer.

  • Create and save an Alloy configuration file on your computer, for example:

    alloy
    logging {
      level  = "info"
      format = "logfmt"
    }

Run a Linux Docker container

To run Alloy as a Linux Docker container, run the following command in a terminal window:

shell
docker run \
  -v <CONFIG_FILE_PATH>:/etc/alloy/config.alloy \
  -p 12345:12345 \
  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 path of the configuration file on your host system.

You can modify the last line to change the arguments passed to the Alloy binary. Refer to the documentation for 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 Docker container.

Run a Windows Docker container

To run Alloy as a Windows Docker container, run the following command in a terminal window:

shell
docker run \
  -v "<CONFIG_FILE_PATH>:C:\Program Files\GrafanaLabs\Alloy\config.alloy" \
  -p 12345:12345 \
  grafana/alloy:nanoserver-1809 \
    run --server.http.listen-addr=0.0.0.0:12345 "--storage.path=C:\ProgramData\GrafanaLabs\Alloy\data" \
    "C:\Program Files\GrafanaLabs\Alloy\config.alloy"

Replace the following:

  • <CONFIG_FILE_PATH>: The path of the configuration file on your host system.

You can modify the last line to change the arguments passed to the Alloy binary. Refer to the documentation for 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 above. If you don’t pass this argument, the [debugging UI][UI] won’t be available outside of the Docker container.

Verify

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