Make sure that you have read Using Docker before you continue reading as this chapter is for advanced users. You can find more information on Docker Compose in the official Docker Compose documentation.
Docker Compose is a tool on top of the Docker engine that enables you to define Docker parameters in a structured way using a
docker-compose.yaml file. You can create and start the container with a single
docker-compose command based on your configuration.
To do so, you will need to create
docker-compose.yml in the same directory as described in the Using Docker section:
.├── config.json├── peering.json├── profiles.json├── docker-compose.yml <NEWLY ADDED FILE>├── mainnetdb├── p2pstore└── snapshots └── mainnet
The docker-compose.yml file should have the following content:
version: '3'services: hornet: container_name: hornet image: gohornet/hornet:latest network_mode: host restart: always cap_drop: - ALL volumes: - ./config.json:/app/config.json:ro - ./peering.json:/app/peering.json - ./profiles.json:/app/profiles.json:ro - ./mainnetdb:/app/mainnetdb - ./p2pstore:/app/p2pstore - ./snapshots/mainnet:/app/snapshots/mainnet
You can run the following command in the current directory to create and start a new Hornet container in detached mode (as daemon):
docker-compose up -d
You can find more details on how to configure Hornet in the post installation section.
Follow this step only if you want to run Hornet via Docker Compose.
If you are using any architecture other than
amd64/x86_64, you should edit the
docker-compose.yml file and set the correct architecture where noted.
You can run the following command to build the image and run Hornet:
You can use
CTRL+C to stop the container.
You can add
-d to run detached.
To gracefully stop the container, you can run the following command:
docker-compose down -t 200