Create verdaccio private npm repository with docker

This article will show you the process of setup private npm repository on RHEL8 server

Install docker if you don’t have

Prepare scripts to run docker container on RHEL 8

# Default command to start a docker container from veredaccio official site (https://verdaccio.org/docs/docker#running-verdaccio-using-docker)
docker run -it --rm --name verdaccio -p 4873:4873 verdaccio/verdaccio

# If you need run verdaccio with HTTPS, use below commands
docker run -it --rm --name verdaccio \
  --env "VERDACCIO_PROTOCOL=https" -p 4873:4873
  verdaccio/verdaccio

Run docker container with your SSL enabled domain

Prepare config yaml file for verdaccio
# config.yaml
https:
  key: /verdaccio/certs/verdaccio-key.pem
  cert: /verdaccio/certs/verdaccio-cert.pem
storage: /verdaccio/storage
Upate docker scripts to run verdaccio
docker rm verdaccio; 
docker run -d \
  -p 4873:4873 \
  --rm --name verdaccio \
  -e VERDACCIO_PROTOCOL=https \
  -v $PWD/conf:/verdaccio/conf \
  -v $PWD/storage:/verdaccio/storage \
  -v $PWD/certs:/verdaccio/certs \
  verdaccio/verdaccio

Open firewall for verdaccio


# Update firewall configuration
sudo firewall-cmd --permanent --add-port=4873/tcp                               

# Reload firewall
sudo firewall-cmd --reload

Reference

Scroll to Top