---
title: "Verdaccio Docker Compose and one-click hosting"
description: "Self-host Verdaccio, the lightweight open-source private npm registry: publish your own packages and cache npmjs, with npm, yarn and pnpm."
---

[← All templates](https://pethost.dev/templates/) · [Developer tools](https://pethost.dev/templates/developer-tools/)

# Deploy Verdaccio in one click

A private npm registry for your own packages, which also caches npm’s

A self-hosted alternative to npm Teams, GitHub Packages, and JFrog Artifactory.

[Deploy on Pethost](https://console.pethost.dev/?template=verdaccio)

## What is Verdaccio?

Verdaccio is a lightweight private npm registry, which teams and solo developers run in place of npm’s paid private packages, GitHub Packages or JFrog Artifactory. You publish packages to it with npm publish, and install them with npm, yarn or pnpm as from npmjs. It needs no database: packages and their metadata are files on its disk.

It is also a proxy of the public registry: a package it does not hold comes from npmjs through its uplink and is kept, so later installs come from Verdaccio, not from npmjs, and a scope such as @yourname can stay private while everything else comes from npm. Its web page shows each package’s readme, versions and dependencies.

This template runs Verdaccio with its storage in a volume and one account, the username and password you give, written into its htpasswd file at every start. Sign-up is off, and packages, your own and npm’s, are read and installed only by a user who signed in, so the registry is no open mirror for strangers.

## Hosting Verdaccio on Pethost

1. You sign in to Pethost with a passkey, GitHub or Google. No machine yet? You pick a plan, and the link waits until it is ready.
2. New project opens at Verdaccio. You fill in what it asks for and click Create project: **Username**, **Admin password**.
3. In a minute or two Verdaccio is live at its own address with HTTPS. Its secrets are made at random, and its data is in the nightly backup.
4. It is a project like any other: you or your agent can change it, roll it back or restore it.

## Questions about Verdaccio

**Is Verdaccio free?**

Yes. Verdaccio is open source under the MIT license, with no paid edition, and running it yourself costs only the server.

**How do I publish a package to Verdaccio?**

Run npm login --registry https://your-address/ with your username and password, then npm publish --registry https://your-address/ in the package’s folder. Setting publishConfig.registry in package.json or registry in .npmrc saves typing the address each time.

**Can Verdaccio install public packages too?**

Yes. A package that is not on Verdaccio is fetched from npmjs through its uplink and cached, so you can point npm, yarn or pnpm at Verdaccio alone and get both your packages and public ones. In this template, installing needs a signed-in user too.

**Does Verdaccio work with yarn and pnpm?**

Yes. Verdaccio speaks the npm registry’s protocol, so npm, yarn and pnpm publish to it and install from it once their registry setting points at its address and they have its token.

**How much memory and disk does Verdaccio need?**

Verdaccio is light: about 100 MB of memory; its disk holds your packages and the public ones installed through it, a few megabytes each. On Pethost the Starter plan is enough for it, with room for other apps beside it.

## Verdaccio Docker Compose file

The template is this compose.yaml and the variables written into the project’s .env as it is created. Pethost runs the file as it is written.

**Containers:** verdaccio (verdaccio/verdaccio:6).

**Volumes, in the nightly backup:** storage.

```
services:
  verdaccio:
    image: verdaccio/verdaccio:6
    restart: unless-stopped
    environment:
      VERDACCIO_PUBLIC_URL: ${URL}
      ADMIN_USERNAME: ${ADMIN_USERNAME}
      ADMIN_PASSWORD: ${ADMIN_PASSWORD}
    # The administrator's line of the htpasswd file is written from the username and password
    # given at every start, so its password is the one in the project's .env; the other lines,
    # users the administrator added, stay as they are.
    command:
      - /bin/sh
      - -c
      - |
        node -e '
          const fs = require("node:fs");
          const bcrypt = require("/usr/local/lib/node_modules/verdaccio/node_modules/bcryptjs");
          const file = "/verdaccio/storage/htpasswd";
          const { ADMIN_USERNAME: name, ADMIN_PASSWORD: password } = process.env;
          const lines = fs.existsSync(file) ? fs.readFileSync(file, "utf8").split("\n") : [];
          const others = lines.filter((line) => line && !line.startsWith(name + ":"));
          fs.writeFileSync(file, [...others, name + ":" + bcrypt.hashSync(password, 10)].join("\n") + "\n", { mode: 0o600 });
        ' || exit 1
        unset ADMIN_PASSWORD
        exec verdaccio --config /verdaccio/conf/config.yaml --listen http://0.0.0.0:4873
    configs:
      - source: config
        target: /verdaccio/conf/config.yaml
    volumes:
      - storage:/verdaccio/storage

configs:
  config:
    content: |
      storage: /verdaccio/storage/data
      plugins: /verdaccio/plugins
      web:
        title: Verdaccio
      auth:
        htpasswd:
          file: /verdaccio/storage/htpasswd
          # Nobody signs up with npm adduser: users are lines of the file, which the administrator adds.
          max_users: -1
      uplinks:
        npmjs:
          url: https://registry.npmjs.org/
      # Only users who signed in install or publish, so the registry is no open mirror of npm.
      packages:
        '@*/*':
          access: $$authenticated
          publish: $$authenticated
          unpublish: $$authenticated
          proxy: npmjs
        '**':
          access: $$authenticated
          publish: $$authenticated
          unpublish: $$authenticated
          proxy: npmjs
      server:
        keepAliveTimeout: 60
      middlewares:
        audit:
          enabled: true
      log:
        type: stdout
        format: pretty
        level: http

volumes:
  storage:
```

[compose.yaml](https://pethost.dev/templates/verdaccio/compose.yaml)[See it on GitHub](https://github.com/pethost-dev/templates/tree/main/verdaccio)

## [More in Developer tools](https://pethost.dev/templates/developer-tools/)

- [**Gitea**Git hosting with pull requests and issues](https://pethost.dev/templates/gitea/)
- [**code-server**VS Code in the browser](https://pethost.dev/templates/code-server/)
- [**Kroki**Diagrams from text: PlantUML, Mermaid, Graphviz and more](https://pethost.dev/templates/kroki/)
- [**Coder**Remote development environments from Terraform templates, opened in VS Code, JetBrains, a browser or over SSH](https://pethost.dev/templates/coder/)
- [**Hasura**Instant GraphQL and REST APIs over a Postgres database, with permissions, events and a web console](https://pethost.dev/templates/hasura/)
- [**InsForge**A backend for apps that coding agents build: Postgres, auth, storage and edge functions](https://pethost.dev/templates/insforge/)

Pethost · Stephan Gomer · NIP 1133096755

Pethost

- [Templates](https://pethost.dev/templates/)
- [About](https://pethost.dev/about/)
- [Docs](https://pethost.dev/docs/)
- [Blog](https://pethost.dev/blog/)
- [API](https://pethost.dev/docs/api/)
- [CLI](https://pethost.dev/docs/cli/)
- [Plugin](https://github.com/pethost-dev/plugin)
- [Terms](https://pethost.dev/terms/)
- [Privacy](https://pethost.dev/privacy/)
- [Refunds](https://pethost.dev/refunds/)
- [support@pethost.dev](mailto:support@pethost.dev)

Databases

- [Postgres](https://pethost.dev/postgres/)

Comparisons

- [Coolify vs Dokploy vs CapRover vs Dokku](https://pethost.dev/blog/coolify-vs-dokploy-vs-caprover-vs-dokku/)
- [Coolify Cloud vs Dokploy Cloud](https://pethost.dev/blog/coolify-cloud-vs-dokploy-cloud/)
- [Railway vs Render vs Fly.io pricing](https://pethost.dev/blog/railway-vs-render-vs-fly-io-pricing/)
- [Managed Docker Compose hosting](https://pethost.dev/blog/managed-docker-compose-hosting/)

Alternatives

- [Railway alternatives](https://pethost.dev/blog/railway-alternatives/)
- [Heroku alternatives](https://pethost.dev/blog/heroku-alternatives/)
- [Dokploy alternatives](https://pethost.dev/blog/dokploy-alternatives/)
- [Coolify alternatives](https://pethost.dev/blog/coolify-alternatives/)
- [Render alternatives](https://pethost.dev/blog/render-alternatives/)
- [Sliplane alternatives](https://pethost.dev/blog/sliplane-alternatives/)
