Sourcegraph with Docker Compose

Sourcegraph with Docker Compose is an ideal choice for many Sourcegraph customers who want a simplified single-machine deployment of Sourcegraph with easy configuration and low cost of effort to maintain.

Not sure if Docker Compose is the right choice for you? Learn more about the various Sourcegraph installation options.

Installation

Before you get started, we recommend learning about how Sourcegraph with Docker Compose works.

Cloud installation

Deploy Sourcegraph with Docker Compose to a cloud of your choice.

You will need:

We offer cloud-specific Sourcegraph installation guides:

For next steps and further configuration options, visit the site administration documentation.

Direct installation

Deploy Sourcegraph with Docker Compose to your machine.

You will need:

To get started, configure Sourcegraph with Docker Compose. Then run:

# Move into configuration directory
cd deploy-sourcegraph-docker/docker-compose
# Spin up Sourcegraph!
docker-compose up -d

Once the server is ready (the sourcegraph-frontend-0 service is healthy when running docker ps), navigate to the hostname or IP address on port 80. Create the admin account, then you'll be guided through setting up Sourcegraph for code searching and navigation.

For next steps and further configuration options, visit the site administration documentation.

About

Docker Compose

Docker Compose is a tool for defining and running multi-container Docker applications (in this case, Sourcegraph!). With Docker Compose, you use a YAML file to configure your application’s services. Then, with a single command, you create and start all the services from your configuration. Learn more about Docker Compose here.

Our Docker Compose support also has the following requirements:

  • Minimum Docker version: v20.10.0
  • Minimum version of Docker Compose: v1.29.0 (this is the first version that supports the service_completed_successfully dependency condition)
  • Docker Compose deployments should only be deployed with one of our supported installation methods, and not Docker Swarm

Reference repository

Sourcegraph for Docker Compose is configured using our sourcegraph/deploy-sourcegraph-docker reference repository. This repository contains everything you need to spin up and configure a Docker Compose Sourcegraph instance.

Windows support

ARM / ARM64 support

The Docker Compose installation requires a minimum of 8 CPU cores (logical) on the host machine in order to complete successfully. If using the Docker for Windows app, the default CPU count is limited to 2 which will result in errors during installation. You can go into the Docker app Settings->Resources window to increase the CPU count to > 8 to resolve this issue.