Hanzo

(Optional) Try with Docker

Try Hanzo Cloud with Docker

Requirements

Hardware

If you want to build the Docker image yourself, please ensure that your machine has at least 2GB of memory. Hanzo Cloud's frontend is an NPM project of React. Building the frontend requires at least 2GB of memory. Having less than 2GB of memory may result in a frontend build failure.

If you only need to run the pre-built image, please ensure that your machine has at least 100MB of memory.

OS

All operating systems (Linux, Windows, and macOS) are supported.

Docker

You can use Docker (docker-engine version >= 17.05) in Linux or Docker Desktop in Windows and macOS.

Regardless of the operating system, users must ensure that they have docker-engine version >= 17.05. This is because we utilize the multi-stage build feature in the docker-compose.yml, which is supported in versions 17.05 and above. For more information, see https://docs.docker.com/develop/develop-images/multistage-build/.

If you use docker-compose, please ensure you have docker-compose version >= 2.2. For Linux users, note that docker-compose needs to be installed separately from docker-engine.

Get the image

We have provided two DockerHub images:

NameDescriptionSuggestion
cloud-all-in-oneBoth Hanzo Cloud and a MySQL database are included in the imageThis image already includes a toy database and is only for testing purposes
cloudOnly Hanzo Cloud is included in the imageThis image can be connected to your own database and used in production
  1. hanzoai/cloud: This image includes the cloud binary, a MySQL database, and all the necessary configurations. It is designed for new users who want to try Hanzo Cloud quickly. With this image, you can start Hanzo Cloud immediately with just one or two commands, without any complex configuration. However, please note that we do not recommend using this image in a production environment.

Option-1: Use the toy database

Run the container with port 14000 exposed to the host. The image will be automatically pulled if it doesn't exist on the local host.

docker run -p 14000:14000 hanzoai/cloud

Visit [**http://localhost:14000**](http://localhost:14000) in your browser. Log into the Hanzo Cloud dashboard with the default global admin account: `built-in/admin`

```bash
admin
123

### **Option-2**: Try with docker-compose

Create a `conf/app.conf` directory in the same directory level as the `docker-compose.yml` file. Then, copy [app.conf](https://github.com/hanzoai/cloud/blob/master/conf/app.conf) from Hanzo Cloud. For more details about `app.conf`, you can see [Via Ini file](/docs/services/cloud/basic/server-installation#via-ini-file).

Below is a minimal but complete `docker-compose.yml` example that starts a MySQL database and the Hanzo Cloud service. It configures Hanzo Cloud to connect to the database using MySQL. Save this file as `docker-compose.yml` (next to a `conf` folder if you want to mount a custom `app.conf`).

```yaml
services:
  db:
    image: mysql:8.0
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: 123456
      MYSQL_DATABASE: cloud
    volumes:
      - db_data:/var/lib/mysql
    ports:
      - "3306:3306" # optional: expose DB to host

  cloud:
    image: hanzoai/cloud:latest
    restart: unless-stopped
    depends_on:
      - db
    environment:
      # Use MySQL driver and point to the db service (service name = host)
      - driverName=mysql
      - dataSourceName=root:123456@tcp(db:3306)/
    ports:
      - "14000:14000"
    volumes:
      # optional: mount your configuration
      - ./conf/app.conf:/conf/app.conf

volumes:
  db_data:

What does the above compose file do:

* The Hanzo Cloud container connects to the database using the Compose service name `db` (i.e. `db:3306`). When both services run in the same Docker network (default for compose), using the service name as host is the simplest and most reliable approach.
* The `dataSourceName` above uses the MySQL root account for simplicity. For production use please create a dedicated DB user and a strong password.
* Mounting `./conf/app.conf` into `/conf/app.conf` is optional. If you prefer environment variables, you can remove the mount and rely on the `driverName` and `dataSourceName` variables.
* If both `app.conf` and environment variables are provided, the environment variables take precedence and will override the corresponding settings in app.conf.


> **Note**

**Hanzo IAM**: By default Hanzo Cloud uses the hosted Hanzo IAM instance at `https://hanzo.id` for user authentication. If you need to manage users, applications, or customize the authentication flow, you must deploy your own Hanzo IAM instance and update Hanzo Cloud's `app.conf` (or the equivalent environment variables) to point to your Hanzo IAM server. You can look at **[Hanzo IAM configuration](/docs/services/cloud/basic/server-installation#configure-iam)** for more details.

**`RUNNING_IN_DOCKER`**: By default `RUNNING_IN_DOCKER` is enabled in docker image. When enabled, Hanzo Cloud replaces `localhost` with the Docker bridge address (for example, `host.docker.internal` or the equivalent bridge hostname) so that the container can reach services running on the host.


Bring up the services:

```bash
docker-compose up -d

Check logs (follow):

```bash
docker-compose logs -f cloud

Visit [**http://localhost:14000**](http://localhost:14000) in your browser. Log into the Hanzo Cloud dashboard with the default global admin account: `built-in/admin`

```bash
admin
123

Stop and remove containers and volumes (data removed):

```bash
docker-compose down -v

### **Option-3**: Try directly with the standard image


> **Tip**


If it is not convenient to mount the configuration file to a container, using environment variables is also a possible solution.

```bash title="example"

docker run \
  -e driverName=mysql \
  -e dataSourceName='user:password@tcp(x.x.x.x:3306)/' \
  -p 14000:14000 \
  hanzoai/cloud:latest




Create `conf/app.conf`. You can copy it from [conf/app.conf](https://github.com/hanzoai/cloud/blob/master/conf/app.conf) in Hanzo Cloud. For more details about `app.conf`, you can see [Via Ini file](/docs/services/cloud/basic/server-installation#via-ini-file).

Then run

```bash
docker run  -p 14000:14000 -v /folder/of/app.conf:/conf hanzoai/cloud:latest

Anyway, just **mount the app.conf to /conf/app.conf** and start the container.

Visit [**http://localhost:14000**](http://localhost:14000) in your browser. Log into the Hanzo Cloud dashboard with the default global admin account: `built-in/admin`

```bash
admin
123

How is this guide?

Last updated on

On this page