Testing Locally with Docker
Last updated
Last updated
We provide a Docker container that makes task development very seamless and straightforward. We chose to use Docker in order to provide all the required task development resources in a consistent and isolated environment.
Install Docker here:
The .env.example
file contains a list of environment variables and their descriptions.
To run the task environment, run the command below:
Following the execution of the command above, three Docker images are created: redis
, K2
, and task-node
. All required dependencies are installed, and the complete stack for task creation is set up for you.
After creating a new task, add the task ID to the TASKS
variable in the task-environment directory. You can add more than one task by separating the IDs with a comma. After adding your task ID(s), you can run docker compose up --build
again to build the container and run the task(s).
The Docker container provided is an integration of , , and in one environment. The complete architecture for task development will be configured after running the Docker container. There's no need to clone the K2 repo or run the test validator locally; K2 is automatically configured and a staking wallet is created for you.
To run the task development environment, ensure you have installed on your local machine.
Clone the repository, and you should have a project with a folder structure similar to the one below:
Now that the task environment is set up, you can create a new task. Refer to learn how to create a task. Configure your RPC URL to point to the test validator running on Docker, which is . Run the command below to change your RPC URL to point to the test validator running on Docker:
Run the command below to confirm that it has been set to :