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:
- A dedicated host for use with Sourcegraph.
- Use the resource estimator to ensure you provision enough capacity.
- Sourcegraph requires SSD backed storage.
- The configured host must have Docker Compose (also see Docker Compose Requirements).
- Sourcegraph license. You can run through these instructions without one, but you must obtain a license for instances of more than 10 users.
We offer cloud-specific Sourcegraph installation guides:
- Install Sourcegraph with Docker Compose on Amazon Web Services
- Install Sourcegraph with Docker Compose on Google Cloud
- Install Sourcegraph with Docker Compose on DigitalOcean
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:
- Docker Compose installed (also see Docker Compose Requirements)
- Use the resource estimator to ensure your machine has sufficient capacity.
- Sourcegraph license. You can run through these instructions without one, but you must obtain a license for instances of more than 10 users.
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.