Using Docker Compose

Make sure that you have read Using Docker before continue reading. This chapter is for more advanced users. The following link provides more information about Docker Compose.

Using your own Docker Compose file for running Hornet

Docker Compose is a tool on top of the Docker engine that enables you to define Docker parameters in a structured way via docker-compose.yaml file. You can create and start the container with a single docker-compose command based on your configuration.

Create docker-compose.yml file among the other files created above:

├── config.json
├── peering.json
├── profiles.json
├── docker-compose.yml      <NEWLY ADDED FILE>
├── mainnetdb
└── snapshots
    └── mainnet
version: '3'
    container_name: hornet
    image: gohornet/hornet:latest
    network_mode: host
    restart: always
      - ALL
      - ./config.json:/app/config.json:ro
      - ./peering.json:/app/peering.json
      - ./profiles.json:/app/profiles.json
      - ./snapshots/mainnet:/app/snapshots/mainnet
      - ./mainnetdb:/app/mainnetdb

Run the following command in the current directory to create and start an new Hornet container in detached mode (as daemon).

docker-compose up -d

See more details on how to configure Hornet under the post installation chapter.

Build your own image using Docker Compose

Note: Follow this step only if you want to run Hornet via Docker Compose.

If you are using an architecture other than amd64/x86_64 edit the docker-compose.yml file and set the correct architecture where noted.

The following command will build the image and run Hornet:

docker-compose up

CTRL-c to stop.

Add -d to run detached, and to stop:

docker-compose down -t 200