> For the complete documentation index, see [llms.txt](https://docs.u2u.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.u2u.xyz/network/run-normal-node/run-via-docker.md).

# Run via Docker

## Prerequisites

### Docker and Docker compose

[Docker](https://docs.docker.com/get-docker/) and [Docker Compose](https://docs.docker.com/compose/install/) are required to run node.

### Pulling sources

First off, create a directory to store source codes and files for next steps (feel free to name it):

```
mkdir u2u_node
```

Change to created directory `u2u_node`:

```
cd u2u_node
```

#### Repository u2u-genesis

Clone the `u2u-genesis` repository to `u2u_node`:

```
git clone https://github.com/unicornultrafoundation/u2u-genesis.git
cd u2u-genesis
git checkout main
```

#### Repository go-u2u

Clone the `go-u2u` repository to `u2u_node`:

```
git clone https://github.com/unicornultrafoundation/go-u2u.git
cd go-u2u
git checkout stable
```

## Dockerfile

Create a file `Dockerfile` inside `u2u_node`. Below is the sample `Dockerfile`:

```
FROM golang:1.20-alpine as builder

RUN apk add --no-cache make gcc musl-dev linux-headers git

WORKDIR /go/go-u2u
COPY ./go-u2u .

ARG GOPROXY
RUN go mod download
RUN make u2u

FROM alpine:latest

RUN apk add --no-cache ca-certificates

COPY --from=builder /go/go-u2u/build/u2u /

EXPOSE 8545 8546 8547 30303

ENTRYPOINT ["/u2u"]
```

## docker-compose.yaml

Create a file `docker-compose.yaml` inside `u2u_node`. Below is sample `docker-compose.yaml` file:

```docker
version: "3"
services:
  u2u_node:
    build: .
    image: go-u2u:stable
    restart: always
    volumes:
      - u2u_node:/root/.u2u
      - ./u2u-genesis/mainnet.g:/genesis.g
    ports:
      - 8545:8545
      - 8546:8546
      - 30303:30303
    command: --genesis /genesis.g
      --genesis.allowExperimental
      --http
      --http.addr="0.0.0.0"
      --http.port=8545
      --http.corsdomain="*"
      --http.api="eth,debug,net,admin,web3,personal,txpool,dag"
      --ws
      --ws.addr "0.0.0.0"
      --ws.port=8546
      --ws.api "eth,debug,net,web3,txpool,dag"
      --ws.origins "*"
      --enabletxtracer
      --gcmode full
      --port 30303
    network_mode: host
volumes:
  u2u_node:
```

Note that:

* To run node on Solaris mainnet: you need to replace genesis file to `./u2u-genesis/mainnet.g`.
* To run node on Nebulas testnet: you need to replace genesis file to `./u2u-genesis/testnet.g`.

{% hint style="warning" %}
Since we have not published the testnet yet for external nodes to join. However, we are working on it, hang tight :tada:
{% endhint %}

## Run

Now your `u2u_node` folder will look like this:

```
docker-compose.yaml
Dockerfile
go-u2u/
u2u-genesis/
```

To run a node with Docker compose, open Terminal at `u2u_node` folder:

```
docker-compose up
```
