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

# Run a Fuego Node with Docker

> Deploy a Fuego full node using Docker or Docker Compose, covering port mapping, blockchain data persistence, and daemon RPC access.

Running Fuego in a Docker container is the fastest way to get a full node up without installing build dependencies on your host system. The official multi-stage `Dockerfile` compiles the node binaries from source inside an Ubuntu 22.04 builder image, then copies only the stripped binaries into a minimal runtime image. This keeps the final image small and free of build toolchain bloat. The container exposes port `20808` for peer-to-peer traffic and port `28180` for the daemon RPC.

## Prerequisites

* Docker 20.10 or later
* Docker Compose v2 (if using Compose)
* \~20 GB of free disk space for the blockchain data volume

## Build the image

Clone the Fuego repository and build the Docker image from the project root:

```bash theme={null}
git clone https://github.com/usexfg/fuego
cd fuego
docker build -t fuego-node:latest .
```

The build uses two arguments you can override if needed:

| Argument               | Default   | Description                   |
| ---------------------- | --------- | ----------------------------- |
| `BUILD_TYPE`           | `Release` | CMake build type              |
| `ENABLE_OPTIMIZATIONS` | `ON`      | Enable compiler optimizations |

To pass custom build arguments:

```bash theme={null}
docker build \
  --build-arg BUILD_TYPE=Release \
  --build-arg ENABLE_OPTIMIZATIONS=ON \
  -t fuego-node:latest .
```

<Steps>
  <Step title="Run the node container">
    Start a container with P2P and RPC ports mapped and a named volume for blockchain data persistence:

    ```bash theme={null}
    docker run -d \
      --name fuego-node \
      -p 20808:20808 \
      -p 28180:28180 \
      -v fuego-data:/home/fuego/.fuego \
      fuego-node:latest
    ```

    The container starts `fuegod` with `--data-dir=/home/fuego/.fuego`, `--rpc-bind-ip=0.0.0.0`, and `--rpc-bind-port=28180` by default, as defined in the `Dockerfile` `CMD`.

    <Note>
      Always use a named volume (or a bind mount to a persistent path) for `/home/fuego/.fuego`. If you remove and recreate the container without a persistent volume, the node will re-download the entire blockchain from scratch.
    </Note>
  </Step>

  <Step title="Verify the node is running">
    Check the container logs to confirm the node is syncing:

    ```bash theme={null}
    docker logs -f fuego-node
    ```

    You can also query the RPC health endpoint directly:

    ```bash theme={null}
    curl http://127.0.0.1:28180/getinfo
    ```

    A JSON response with `height` and peer information confirms the daemon is responding.
  </Step>

  <Step title="Deploy with Docker Compose">
    The included `docker-compose.yml` starts both the `fuego-node` (daemon) and `fuego-wallet` (`walletd`) services on an isolated bridge network. Both services share the same built image.

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

    The Compose file maps the following ports:

    | Service        | Port    | Purpose                |
    | -------------- | ------- | ---------------------- |
    | `fuego-node`   | `20808` | P2P networking         |
    | `fuego-node`   | `28180` | Daemon RPC             |
    | `fuego-wallet` | `8070`  | Wallet RPC (`walletd`) |

    `fuego-wallet` connects to `fuego-node` automatically via the internal `fuego-network` bridge using the hostname `fuego-node` on port `28180`.

    To bring only the node service up (without the wallet):

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

    To include the optional Nginx reverse proxy (defined with a `web` profile):

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

    <Note>
      Two named volumes are created by Compose: `fuego-data` for blockchain state and `fuego-wallet-data` for wallet files. Both persist across `docker compose down` restarts. They are only removed if you run `docker compose down -v`.
    </Note>
  </Step>

  <Step title="Execute commands inside the container">
    Open an interactive shell or run a single command inside the running container:

    ```bash theme={null}
    # Run a single command
    docker exec -it fuego-node fuegod help

    # Open an interactive shell
    docker exec -it fuego-node /bin/bash
    ```

    From the shell you can inspect data files in `/home/fuego/.fuego` or check daemon status interactively.
  </Step>
</Steps>

## Restrict RPC access in production

By default the RPC port is bound to all interfaces (`0.0.0.0`) inside the container, which is then exposed on your host via `-p 28180:28180`. In a production environment you should either bind the port to `127.0.0.1` on the host or enable restricted mode:

<Tip>
  Pass `--restricted-rpc` to `fuegod` to disable wallet-sensitive RPC methods and expose only read-only node information. Override the default `CMD` when running the container:

  ```bash theme={null}
  docker run -d \
    --name fuego-node \
    -p 20808:20808 \
    -p 28180:28180 \
    -v fuego-data:/home/fuego/.fuego \
    fuego-node:latest \
    --data-dir=/home/fuego/.fuego \
    --rpc-bind-ip=0.0.0.0 \
    --rpc-bind-port=28180 \
    --restricted-rpc
  ```
</Tip>

## Health check

The `Dockerfile` includes a built-in health check that polls the RPC endpoint every 30 seconds:

```bash theme={null}
curl -f http://localhost:28180/getinfo
```

You can monitor container health status with:

```bash theme={null}
docker inspect --format='{{.State.Health.Status}}' fuego-node
```

A status of `healthy` means the daemon is running and responding to RPC requests.
