Install with Docker Compose

This guide will have you up running Dragonfly with docker-compose in just a few minutes.

If you do not have docker and docker-compose installed on your machine, before continuing install Docker and Docker Compose.

Step 1

  1. # Download Official Dragonfly Docker Compose File
  2. wget https://raw.githubusercontent.com/dragonflydb/dragonfly/main/contrib/docker/docker-compose.yml
  3. # Launch the Dragonfly Instance
  4. docker-compose up -d
  5. # Confirm image is up
  6. docker ps | grep dragonfly
  7. # ac94b5ba30a0 docker.dragonflydb.io/dragonflydb/dragonfly "entrypoint.sh drago…" 45 seconds ago Up 31 seconds 0.0.0.0:6379->6379/tcp, :::6379->6379/tcp docker_dragonfly_1
  8. # Log follow the dragonfly container
  9. docker logs -f docker_dragonfly_1

Dragonfly will respond to both http and redis requests out of the box!

You can use redis-cli to connect to localhost:6379 or open a browser and visit http://localhost:6379

Step 2

Connect with a redis client.

From a new terminal:

  1. redis-cli
  2. 127.0.0.1:6379> set hello world
  3. OK
  4. 127.0.0.1:6379> keys *
  5. 1) "hello"
  6. 127.0.0.1:6379> get hello
  7. "world"
  8. 127.0.0.1:6379>

Step 3

Continue being great and build your app with the power of Dragonfly!

Tuning Dragonfly

If you are attempting to tune Dragonfly for performance, consider NAT performance costs associated with containerization.

Performance Tuning

In docker-compose, there is a significant difference between using an overlay network (which relies on docker NAT traversal for every request) and the host network (see docker-compose.yml).

For more information, see the Docker compose file network_mode docs.