Run Hero in a Docker container for easy setup, consistent environments, and isolation from your host system.
Find a file
2025-12-24 10:45:07 +00:00
docs docs: Add instructions for pulling and running Docker images from registry 2025-12-10 12:16:08 -05:00
root/etc/zinit chore: Update Dockerfile to include mycelium and zinit, remove start.sh, and adjust README for new container behavior 2025-12-24 07:22:03 +02:00
.gitignore init 2025-12-10 07:59:59 -05:00
Dockerfile streamline package installation 2025-12-24 08:09:10 +02:00
README.md chore: Update Dockerfile to include mycelium and zinit, remove start.sh, and adjust README for new container behavior 2025-12-24 07:22:03 +02:00

Hero Docker Container

Introduction

A Docker-based development environment for Hero development with essential tools and configurations. This container comes pre-installed with Bun, Redis, and the Hero CLI.

Prerequisites

  • Docker installed on your system
  • SSH keys for deploying Hero websites (if publishing)

Build the Image

Build the Docker image:

docker build -t hero_docker .

Run the Container

Run the container with an interactive shell, mounting your current directory as the workspace and your SSH keys:

docker run --privileged --device=/dev/net/tun --network=host \
  -v $(pwd):/workspace \
  -v ~/.ssh:/root/ssh \
  -it hero_docker

Note: The --privileged and --device=/dev/net/tun flags are required for mycelium to create and configure TUN network interfaces.

By default, the container will:

  • Start Redis server in the background
  • Copy your SSH keys to the proper location
  • Initialize the SSH agent
  • Add your default SSH key (id_ed25519)
  • Start mycelium networking service

To use a different SSH key, specify it with the KEY environment variable (e.g. KEY=id_ed25519):

docker run --privileged --device=/dev/net/tun --network=host \
  -v $(pwd):/workspace \
  -v ~/.ssh:/root/ssh \
  -e KEY=your_custom_key_name \
  -it hero_docker

Launch the Hero Website

To start a Hero Docusaurus website in development mode:

  • Build the book then close the prompt with Ctrl+C
    hero docs -d
    
  • See the book on the local browser
    bash /root/hero/var/docs/develop.sh
    

You can then view the website in your browser at https://localhost:3100.

Publish a Website

  • To build and publish a Hero website:
    • Development
      hero docs -bpd
      
    • Production
      hero docs -bp
      

If you want to specify a different SSH key, use -dk:

hero docs -bpd -dk ~/.ssh/id_ed25519

Note: The container handles the SSH agent and key management automatically on startup, so in most cases, you won't need to manually specify keys.