> For the complete documentation index, see [llms.txt](https://docs.ipcheck.ing/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ipcheck.ing/developer/getting-started/deploy-with-docker.md). Agents can also search and read this documentation through its [MCP server](https://docs.ipcheck.ing/~gitbook/mcp).

# Deploy with Docker

Run MyIP with docker run or Docker Compose, and keep your instance up to date.

Docker is the recommended way to self-host MyIP. One image contains both halves of the app: the built Vue frontend and the Express backend.

## Images

| Registry        | Image                            |
| --------------- | -------------------------------- |
| Docker Hub      | `jason5ng32/myip:latest`         |
| GitHub Packages | `ghcr.io/jason5ng32/myip:latest` |

Both are built from the same release and published for `linux/amd64` and `linux/arm64`. Every release also gets a version tag alongside `:latest` — pin to one if you want reproducible upgrades.

## Run it

{% tabs %}
{% tab title="docker run" %}
{% code title="docker run" %}

```bash
docker run -d \
  -p 18966:18966 \
  -e MAXMIND_ACCOUNT_ID="your-account-id" \
  -e MAXMIND_LICENSE_KEY="your-license-key" \
  -e DATASET_AUTO_UPDATE="true" \
  -e ALLOWED_DOMAINS="myip.example.com" \
  -e GOOGLE_MAP_API_KEY="your-key" \
  -e IPLOCATE_IO_API_KEY="your-key" \
  -e LOG_LEVEL="info" \
  --name myip \
  --restart always \
  jason5ng32/myip:latest
```

{% endcode %}
{% endtab %}

{% tab title="Docker Compose" %}
{% code title="compose.yaml" %}

```yaml
services:
  myip:
    image: jason5ng32/myip:latest
    container_name: myip
    restart: always
    ports:
      - "18966:18966"
    environment:
      # Required — see MaxMind Setup
      MAXMIND_ACCOUNT_ID: "your-account-id"
      MAXMIND_LICENSE_KEY: "your-license-key"
      # Required once you serve MyIP on a domain
      ALLOWED_DOMAINS: "myip.example.com"
      # Optional
      DATASET_AUTO_UPDATE: "true"
      GOOGLE_MAP_API_KEY: "your-key"
      IPLOCATE_IO_API_KEY: "your-key"
      LOG_LEVEL: "info"
```

{% endcode %}

Start it with `docker compose up -d`.
{% endtab %}
{% endtabs %}

Only `MAXMIND_ACCOUNT_ID` and `MAXMIND_LICENSE_KEY` are needed to get a working instance; `DATASET_AUTO_UPDATE="true"` is already the default. Everything else above is optional — the complete list lives in [Environment Variables](https://docs.ipcheck.ing/developer/reference/environment-variables.md).

{% hint style="info" %}
Prefer an env file over inline secrets: put the variables in `.env` next to your compose file and Compose picks them up, or pass `--env-file .env` to `docker run`.
{% endhint %}

## Ports

The container runs two Node processes:

| Process                                                           | Port                      | Published? |
| ----------------------------------------------------------------- | ------------------------- | ---------- |
| Frontend — serves the built SPA and proxies `/api` to the backend | `18966` (`FRONTEND_PORT`) | Yes        |
| Backend — the Express API                                         | `11966` (`BACKEND_PORT`)  | No         |

The frontend proxies `/api` to `http://localhost:<BACKEND_PORT>` **inside the container**, so you never publish the backend port. Only `18966` is exposed by the image.

To serve MyIP on a different host port, change the left side of the mapping:

```bash
-p 8080:18966
```

If you change `FRONTEND_PORT`, change the right side of the mapping to match.

## `VITE_*` variables do not work on the prebuilt image

Variables whose name starts with `VITE_` are read by Vite at **build time** and baked into the JavaScript bundle. The published image is built in CI without an `.env` file, so passing them with `-e` at runtime has no effect on the frontend.

That applies to every `VITE_*` variable — among them `VITE_CURL_IPV4_DOMAIN`, `VITE_CURL_IPV6_DOMAIN`, `VITE_CURL_IPV64_DOMAIN`, `VITE_GOOGLE_ANALYTICS_ID`, `VITE_SITE_URL`, `VITE_SENTRY_DSN_FRONTEND`, `VITE_DOCS_URL`, `VITE_PULSE_BEACON_URL`, `VITE_INVISIBILITY_TEST_SCRIPT_URL`, `VITE_DNS_LEAK_TEST_DOMAIN` and the three `VITE_FIREBASE_*` sign-in variables. To set them you need to build your own image (or use [Deploy with Node.js](https://docs.ipcheck.ing/developer/getting-started/deploy-with-nodejs.md)):

```bash
git clone https://github.com/jason5ng32/MyIP.git
cd MyIP
cp .env.example .env   # fill in the VITE_* values
docker build -t myip-custom .
```

{% hint style="info" %}
Three of them are exceptions, because the server reads them **at runtime** as well: `VITE_SENTRY_DSN_FRONTEND` decides whether the `/api/monitoring` tunnel is mounted (see [Error Monitoring](https://docs.ipcheck.ing/developer/configuration/error-monitoring.md)), `VITE_SITE_URL` builds the `User-Agent` sent to upstream providers, and `VITE_FIREBASE_PROJECT_ID` is what the backend verifies sign-in against and what the `/__/auth/*` proxy points at (see [User Accounts](https://docs.ipcheck.ing/developer/configuration/user-accounts.md)). If you bake any of them in at build time, pass the same value to the container at runtime too.
{% endhint %}

## Where data lives

MyIP downloads a few datasets at runtime. They live **inside the container**, under `/app/common/`:

| Path                        | Contents                                                                                                                                                                    |
| --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `/app/common/maxmind-db/`   | `GeoLite2-City.mmdb`, `GeoLite2-ASN.mmdb` — the MaxMind IP source and the Bulk IP Lookup tool                                                                               |
| `/app/common/as-org-db/`    | CAIDA `as-org2info.txt` — ASN organization names                                                                                                                            |
| `/app/common/as-rel-db/`    | CAIDA `as-rel2.txt` — the ASN connectivity graph and relationship counts                                                                                                    |
| `/app/common/peeringdb-db/` | `peeringdb-index.json` — the PeeringDB data behind the ASN Profile tool, distilled from CAIDA's mirror of the PeeringDB dump. Only present when `CLOUDFLARE_API_KEY` is set |
| `/app/common/oui-db/`       | The five IEEE MAC registries (`oui.csv`, `mam.csv`, `oui36.csv`, `iab.csv`, `cid.csv`) behind the MAC Lookup tool                                                           |

Each directory also keeps the updater's state and lock files. None of these are baked into the image (MaxMind's GeoLite2 license forbids redistribution), and none of them are precious — every one is re-downloaded on a fresh start. Recreating the container simply means MyIP fetches them again on first boot.

{% hint style="info" %}
**The PeeringDB step needs a little headroom.** With `CLOUDFLARE_API_KEY` set, the backend downloads a \~116 MB dump into the container's temp directory, distills it into the \~6 MB index, then deletes the dump. The distiller streams the file instead of parsing it whole, built for small instances: the backend process peaked at about 220 MB RSS during the step, measured on the development machine. No contact data from the dump is ever stored.
{% endhint %}

One more directory holds state rather than downloads: with [`IP_SOURCE_DAILY_LIMITS`](https://docs.ipcheck.ing/developer/reference/environment-variables.md#ip-source-daily-limits) set, `/app/common/source-limits-db/` keeps the day's count of successful answers per IP source, so a restart of the same container carries on counting. Recreating the container — an upgrade, for instance — starts the day from zero unless that directory is on a volume.

If you would rather not re-download on every upgrade, or want the daily counts to survive one, mount volumes:

{% code title="compose.yaml (excerpt)" %}

```yaml
    volumes:
      - myip-maxmind:/app/common/maxmind-db
      - myip-asorg:/app/common/as-org-db
      - myip-asrel:/app/common/as-rel-db
      - myip-peeringdb:/app/common/peeringdb-db
      - myip-oui:/app/common/oui-db
      - myip-source-limits:/app/common/source-limits-db

volumes:
  myip-maxmind:
  myip-asorg:
  myip-asrel:
  myip-peeringdb:
  myip-oui:
  myip-source-limits:
```

{% endcode %}

## Upgrading

{% tabs %}
{% tab title="docker run" %}

```bash
docker pull jason5ng32/myip:latest
docker stop myip && docker rm myip
# then re-run your original `docker run` command
```

{% endtab %}

{% tab title="Docker Compose" %}

```bash
docker compose pull
docker compose up -d
```

{% endtab %}
{% endtabs %}

After an upgrade without volumes, the first boot re-downloads the GeoLite2, CAIDA and IEEE MAC datasets (and PeeringDB, when `CLOUDFLARE_API_KEY` is set). The backend starts listening straight away and downloads them in the background, each capped at 5 minutes. Until a dataset lands, the routes reading it answer `503` — MaxMind lookups, the ASN connectivity graph and MAC Lookup, for instance — and the ASN Profile marks the affected sections as errors. A download that misses its cap does not stop the server; that dataset is retried on the next boot, or by the daily refresh.

## Checking on it

```bash
docker logs -f myip
```

A healthy startup shows the backend and frontend listeners plus the MaxMind load:

```
🚀 Backend server ready on http://localhost:11966
🚀 Static file server ready on http://localhost:18966
📦 MaxMind databases loaded (startup)
```

Each Node process also prints `.env not found. Continuing without it.` That is expected: the container takes its variables from `-e` / `environment:`, not from a file.

If you see `❌ MaxMind API will return 503 until databases are available`, go to [MaxMind Setup](https://docs.ipcheck.ing/developer/getting-started/maxmind-setup.md#troubleshooting).

## Next steps

* [MaxMind Setup](https://docs.ipcheck.ing/developer/getting-started/maxmind-setup.md) — required credentials and how the auto-updater works
* [Reverse Proxy & Domains](https://docs.ipcheck.ing/developer/getting-started/reverse-proxy-and-domains.md) — TLS, Nginx/Caddy, `ALLOWED_DOMAINS`
* [Security Options](https://docs.ipcheck.ing/developer/configuration/security-options.md) — edge or reverse-proxy rate limiting and `ALLOWED_DOMAINS`
* [Logging](https://docs.ipcheck.ing/developer/configuration/logging.md) — log level, JSON output, HTTP request logs


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.ipcheck.ing/developer/getting-started/deploy-with-docker.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
