Skip to main content

Docker Quick Start

This guide explains how to run Freqtrade with Docker. This is the recommended method for beginners as it provides a consistent environment across different platforms.

Configuration Required

This setup is not meant to work out of the box. You'll still need to read through the documentation and understand how to properly configure Freqtrade.

Install Docker

First, download and install Docker Desktop for your platform:

Docker Compose

Freqtrade documentation assumes the use of Docker Desktop (or the docker compose plugin). While the standalone docker-compose installation still works, you'll need to change all docker compose commands to docker-compose.

Windows Users

If you just installed Docker on Windows, make sure to reboot your system to avoid network connectivity issues with Docker containers.

Quick Start Setup

1. Create Project Directory

mkdir ft_userdata
cd ft_userdata/

2. Download Docker Compose File

# Download the docker-compose file from the repository
curl https://raw.githubusercontent.com/freqtrade/freqtrade/stable/docker-compose.yml -o docker-compose.yml

3. Pull Freqtrade Image

# Pull the freqtrade image
docker compose pull

4. Create User Directory Structure

# Create user directory structure
docker compose run --rm freqtrade create-userdir --userdir user_data

5. Create Configuration

# Create configuration - Requires answering interactive questions
docker compose run --rm freqtrade new-config --config user_data/config.json

This interactive process will ask you questions about:

  • Exchange selection
  • Trading pairs
  • Timeframes
  • Strategy selection
  • Risk management settings
  • API configuration

Configuration

Editing Configuration

The configuration file is available at user_data/config.json. You can edit it at any time to modify:

  • Exchange settings
  • Trading pairs
  • Strategy parameters
  • Risk management rules
  • API keys

Adding Custom Strategies

  1. Copy your custom strategy to user_data/strategies/
  2. Update the strategy name in your docker-compose.yml file
  3. Restart the container
Sample Strategy Warning

The SampleStrategy is included for demonstration purposes only. Always backtest your strategy and use dry-run mode before risking real money!

Running Freqtrade

Start the Bot

# Start in detached mode
docker compose up -d

Check Status

# Check running containers
docker compose ps

View Logs

# View real-time logs
docker compose logs -f

# View specific number of log lines
docker compose logs --tail 50

Stop the Bot

# Stop the bot
docker compose down

Accessing FreqUI

If you enabled FreqUI during configuration, you can access the web interface at:

http://localhost:8080

Remote Server Access

If running on a VPS, use SSH tunneling or VPN instead of exposing FreqUI directly to the internet. FreqUI doesn't support HTTPS out of the box.

Data and Database

File Locations

  • Configuration: user_data/config.json
  • Logs: user_data/logs/freqtrade.log
  • Database: user_data/tradesv3.sqlite
  • Strategies: user_data/strategies/
  • Data: user_data/data/

Backup Important Files

Regularly backup:

  • Configuration files
  • Custom strategies
  • Trading database
  • Log files

Common Docker Commands

Download Market Data

# Download 5 days of data for ETH/BTC pair
docker compose run --rm freqtrade download-data \
--pairs ETH/BTC \
--exchange binance \
--days 5 \
-t 1h

Run Backtesting

# Backtest a strategy
docker compose run --rm freqtrade backtesting \
--strategy SampleStrategy \
--timerange 20230101-20230201

List Available Pairs

# List trading pairs for an exchange
docker compose run --rm freqtrade list-pairs \
--exchange binance \
--quote USDT \
--print-json

Strategy Analysis

# Analyze strategy performance
docker compose run --rm freqtrade plot-dataframe \
--strategy SampleStrategy \
--pairs BTC/USDT

Updating Freqtrade

Update to Latest Version

# Download the latest image
docker compose pull

# Restart with new version
docker compose up -d
Check Changelog

Always check the changelog for breaking changes before updating. Ensure the bot starts correctly after the update.

Update to Specific Version

# Edit docker-compose.yml to specify version
# Change: freqtradeorg/freqtrade:stable
# To: freqtradeorg/freqtrade:2024.1

docker compose pull
docker compose up -d

Advanced Configuration

Custom Docker Compose

You can modify the docker-compose.yml file to:

  • Change port mappings
  • Add environment variables
  • Mount additional volumes
  • Configure resource limits

Example custom configuration:

version: '3'
services:
freqtrade:
image: freqtradeorg/freqtrade:stable
restart: unless-stopped
container_name: freqtrade
volumes:
- "./user_data:/freqtrade/user_data"
ports:
- "8080:8080"
environment:
- FREQTRADE_CONFIG=user_data/config.json
command: >
trade
--logfile user_data/logs/freqtrade.log
--db-url sqlite:///user_data/tradesv3.sqlite
--config user_data/config.json
--strategy SampleStrategy

Running Without Docker Compose

For simple commands that don't require authentication:

# List pairs without compose file
docker run --rm freqtradeorg/freqtrade:stable list-pairs \
--exchange binance \
--quote BTC \
--print-json

Troubleshooting

Common Issues

Container Won't Start:

  • Check logs: docker compose logs
  • Verify configuration file syntax
  • Ensure all required fields are set

Permission Errors:

  • Check file permissions in user_data/ directory
  • Ensure Docker has access to the directory

Network Issues:

  • Restart Docker service
  • Check firewall settings
  • Verify internet connectivity

FreqUI Not Accessible:

  • Check port mapping in docker-compose.yml
  • Verify FreqUI is enabled in configuration
  • Check container logs for errors

Getting Help

Next Steps

After setting up Docker:

  1. Configuration - Learn about detailed configuration options
  2. Strategy Development - Create your first trading strategy
  3. Backtesting - Test your strategies with historical data
  4. Bot Usage - Learn how to operate the bot effectively