LocalAI runs open models for chat, images, speech, and video on your own machines, and its API speaks the OpenAI and Anthropic formats. No GPU is needed for the engine, and a GPU makes it faster. The Docker Compose path is the install the docs recommend when you prefer a container, and it keeps your models and data in volumes so they stay when you recreate or upgrade the container.
Install LocalAI with Docker Compose
Download the compose file and start LocalAI in the background:
curl -fsSL https://localai.io/install/docker-compose.yaml -o docker-compose.yaml
docker compose up -d
The compose file keeps models, backends, settings, and data in named volumes, so they stay when you recreate or upgrade the container. Pick the image that matches your hardware: for a CPU only, use localai/localai:latest; for NVIDIA with CUDA 12, use localai/localai:latest-gpu-nvidia-cuda-12. To use a GPU, change image in docker-compose.yaml to the tag for your hardware, and remove the # from the block for your GPU. With docker run, add --gpus all for NVIDIA. The docs also offer an install script for Linux and Macs with Apple Silicon, but this guide uses Docker Compose.
Install a model and chat in the browser
Open http://localhost:8080 in your browser. On a fresh install, accept the model that the first-run card recommends, and LocalAI downloads it when you agree. Or open Models, then Explore, search for gemma-4-e2b-it-qat-q4_0, and choose Install. It is a small Google Gemma 4 model that runs on a CPU and reads images. The download is 4.3 GB in total: 3.35 GB for the model and 0.99 GB for the image projector. Then open Chats, select the model from the model list, type a message, and send it. On a CPU the first reply takes longer because the model has to load.
Try it: four checks from container to first reply
| Check | What you should see | If you do not see it |
|---|---|---|
| Container running | docker compose up -d finishes and LocalAI answers at http://localhost:8080 |
Check Docker is running and port 8080 is free |
| Model installed | gemma-4-e2b-it-qat-q4_0 listed under Models |
Wait for the 4.3 GB download to finish |
| Chat opens | Chats shows the model in the model list | Install the model from Models, then Explore, first |
| First reply | An answer to the message you typed in Chats | On a CPU the first reply takes longer because the model has to load |
Expected result. We checked the LocalAI quickstart, which gives the Docker Compose commands, the GPU image table, the Models and Explore install steps for gemma-4-e2b-it-qat-q4_0 with its 4.3 GB download, and the Chats steps, and the LocalAI Start here page, which gives the same Docker Compose path and the volume behavior. We did not install or run LocalAI on this machine.
Limits
This guide covers the Docker Compose install and one chat model only. LocalAI also runs text, image, video, speech, sound, vision, and embedding models, and it can build saved agents, but those are separate jobs. LocalAI listens on port 8080 on all interfaces, and authentication is off, so protect the API before you expose it beyond your own machine: run with an API key, or turn on user authentication for admin and user roles. LocalAI downloads a backend the first time a model needs it. We did not test any of this ourselves.
Sources
- LocalAI Quickstart — Docker Compose install, GPU image table, Models then Explore install of gemma-4-e2b-it-qat-q4_0, 4.3 GB download, Chats steps, first reply slower on CPU
- LocalAI Start here — Docker Compose path, compose file keeps models and data in volumes, overview of what LocalAI runs, MIT license
