> ## Documentation Index
> Fetch the complete documentation index at: https://metalayerlabs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Docker Compose Setup

This guide explains how to deploy a Blast node using `docker compose` with pre-built Docker images. This method is ideal for users who prefer not to build from source and want a straightforward setup.

## Prerequisites

Before you begin, ensure that you have [Docker](https://www.docker.com/) and [Docker Compose](https://docs.docker.com/compose/) installed on your machine. You will also need access to a valid L1 RPC endpoint, such as those provided by Alchemy, Infura, or other services.

## Usage Instructions

<Steps>
  <Step title="Clone Deployment Repository">
    Start by cloning the Blast deployment repository, which contains the necessary Docker Compose configurations:

    ```bash theme={null}
    git clone git@github.com:blast-io/deployment.git
    cd deployment
    ```
  </Step>

  <Step title="Configure the Environment Variables">
    Copy the .env.example file to .env and configure the following variables:

    ```bash theme={null}
    cp .env.example .env
    ```

    Edit the .env file to set the required variables:

    * `NETWORK`: Set to `mainnet` or `sepolia` depending on the network you want to connect to.
    * `GETH_DATA_DIR`: Set the path where you want to store the blockchain data.
    * `L1_RPC_URL`: Your L1 RPC endpoint URL.
    * `L1_RPC_KIND`: The type of RPC provider (`alchemy`, `infura`, etc.).
    * `OP_NODE_L1_BEACON`: Your L1 Beacon api endpoint. Required as of Ecotone upgrade.

    These variables are essential for configuring the node to connect to the appropriate network and storage locations.
  </Step>

  <Step title="Start the Docker Containers">
    Once the environment variables are set, you can start the containers using Docker Compose:

    ```bash theme={null}
    docker compose up -d
    ```

    This command pulls the latest versions of the pre-built Docker images and starts the necessary containers, including `blast-geth` and `op-node`.

    <Info>
      The `-d` flag runs the containers in detached mode, allowing them to run in the background.
    </Info>
  </Step>

  <Step title="Test Your Node">
    To test your node, you can run the following command to query the latest L2 block.

    ```bash theme={null}
    curl -d '{ \
      "id":0,
      "jsonrpc":"2.0",
      "method":"eth_getBlockByNumber",
      "params":["latest",false]
    }' -H "Content-Type: application/json" http://localhost:9545
    ```

    <Note>
      You will need to wait for your node to fully sync before this command will return the actual latest block.
    </Note>
  </Step>

  <Step title="Monitor & Manage Containers">
    You can monitor the running containers with:

    ```bash theme={null}
      docker compose ps
    ```

    If you need to stop the containers, use:

    ```bash theme={null}
    docker compose down
    ```

    To update to the latest versions of the images, use:

    ```bash theme={null}
    docker compose pull --policy=always
    docker compose up -d
    ```
  </Step>
</Steps>

## Additional Considerations

To fully participate in p2p, please ensure TCP/UDP is allowed on port `9003`, and add the argument `--p2p.advertise.ip=<host-machine-public-ip>` to the `op-node` service in the `docker-compose.yml file.`

For more details, refer to the official [Blast deployment repository](https://github.com/blast-io/deployment).
