網(wǎng)站首頁(yè) 編程語(yǔ)言 正文
安裝docker鏡像
[root@test5 lianxi]# docker pull verdaccio/verdaccio
[root@test5 lianxi]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
<none> <none> 0849d2c5af48 2 days ago 204MB
verdaccio/verdaccio latest 120b7a8b71d7 13 days ago 149MB
安裝前的配置
因?yàn)閐ocker起verdaccio容器的時(shí)候,會(huì)到config文件夾里面去讀取config.yaml,所以我們需要自己在config文件夾下面新建一個(gè)config.yaml的文件,并將內(nèi)容復(fù)制粘貼進(jìn)去
[root@test5 lianxi]# mkdir ./verdaccio
[root@test5 lianxi]# cd verdaccio
[root@test5 verdaccio]# mkdir config plugins storage
[root@test5 verdaccio]# cd config
[root@test5 config]# vim config.yaml
[root@test5 config]# cat config.yaml
#
#this is the default configuration file. It allows all users to do anything,
# please read carefully the documentation and best practices to
# improve security.
#
# Do not configure host and port under `listen` in this file
# as it will be ignored when using docker.
# see https://verdaccio.org/docs/en/docker#docker-and-custom-port-configuration
#
# Look here for more config file examples:
# https://github.com/verdaccio/verdaccio/tree/5.x/conf
#
# Read about the best practices
# https://verdaccio.org/docs/best
# path to a directory with all packages
storage: /verdaccio/storage/data
# path to a directory with plugins to include
plugins: /verdaccio/plugins
# https://verdaccio.org/docs/webui
web:
title: Verdaccio
# comment out to disable gravatar support
# gravatar: false
# by default packages are ordercer ascendant (asc|desc)
# sort_packages: asc
# convert your UI to the dark side
# darkMode: true
# html_cache: true
# by default all features are displayed
# login: true
# showInfo: true
# showSettings: true
# In combination with darkMode you can force specific theme
# showThemeSwitch: true
# showFooter: true
# showSearch: true
# showRaw: true
# showDownloadTarball: true
# HTML tags injected after manifest <scripts/>
# scriptsBodyAfter:
# - '<script type="text/javascript" src="https://my.company.com/customJS.min.js"></script>'
# HTML tags injected before ends </head>
# metaScripts:
# - '<script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>'
# - '<script type="text/javascript" src="https://browser.sentry-cdn.com/5.15.5/bundle.min.js"></script>'
# - '<meta name="robots" content="noindex" />'
# HTML tags injected first child at <body/>
# bodyBefore:
# - '<div id="myId">html before webpack scripts</div>'
# Public path for template manifest scripts (only manifest)
# publicPath: http://somedomain.org/
# https://verdaccio.org/docs/configuration#authentication
auth:
htpasswd:
file: /verdaccio/storage/htpasswd
# Maximum amount of users allowed to register, defaults to "+infinity".
# You can set this to -1 to disable registration.
# max_users: 1000
# Hash algorithm, possible options are: "bcrypt", "md5", "sha1", "crypt".
# algorithm: bcrypt # by default is crypt, but is recommended use bcrypt for new installations
# Rounds number for "bcrypt", will be ignored for other algorithms.
# rounds: 10
# https://verdaccio.org/docs/configuration#uplinks
# a list of other known repositories we can talk to
uplinks:
npmjs:
url: https://registry.npmjs.org/
# Learn how to protect your packages
# https://verdaccio.org/docs/protect-your-dependencies/
# https://verdaccio.org/docs/configuration#packages
packages:
'@*/*':
# scoped packages
access: $all
publish: $authenticated
unpublish: $authenticated
proxy: npmjs
'**':
# allow all users (including non-authenticated users) to read and
# publish all packages
#
# you can specify usernames/groupnames (depending on your auth plugin)
# and three keywords: "$all", "$anonymous", "$authenticated"
access: $all
# allow all known users to publish/publish packages
# (anyone can register by default, remember?)
publish: $authenticated
unpublish: $authenticated
# if package is not available locally, proxy requests to 'npmjs' registry
proxy: npmjs
# To improve your security configuration and avoid dependency confusion
# consider removing the proxy property for private packages
# https://verdaccio.org/docs/best#remove-proxy-to-increase-security-at-private-packages
# https://verdaccio.org/docs/configuration#server
# You can specify HTTP/1.1 server keep alive timeout in seconds for incoming connections.
# A value of 0 makes the http server behave similarly to Node.js versions prior to 8.0.0, which did not have a keep-alive timeout.
# WORKAROUND: Through given configuration you can workaround following issue https://github.com/verdaccio/verdaccio/issues/301. Set to 0 in case 60 is not enough.
server:
keepAliveTimeout: 60
# Allow `req.ip` to resolve properly when Verdaccio is behind a proxy or load-balancer
# See: https://expressjs.com/en/guide/behind-proxies.html
# trustProxy: '127.0.0.1'
# https://verdaccio.org/docs/configuration#offline-publish
# publish:
# allow_offline: false
# https://verdaccio.org/docs/configuration#url-prefix
# url_prefix: /verdaccio/
# VERDACCIO_PUBLIC_URL='https://somedomain.org';
# url_prefix: '/my_prefix'
# // url -> https://somedomain.org/my_prefix/
# VERDACCIO_PUBLIC_URL='https://somedomain.org';
# url_prefix: '/'
# // url -> https://somedomain.org/
# VERDACCIO_PUBLIC_URL='https://somedomain.org/first_prefix';
# url_prefix: '/second_prefix'
# // url -> https://somedomain.org/second_prefix/'
# https://verdaccio.org/docs/configuration#security
# security:
# api:
# legacy: true
# jwt:
# sign:
# expiresIn: 29d
# verify:
# someProp: [value]
# web:
# sign:
# expiresIn: 1h # 1 hour by default
# verify:
# someProp: [value]
# https://verdaccio.org/docs/configuration#user-rate-limit
# userRateLimit:
# windowMs: 50000
# max: 1000
# https://verdaccio.org/docs/configuration#max-body-size
# max_body_size: 10mb
# https://verdaccio.org/docs/configuration#listen-port
# listen:
# - localhost:4873 # default value
# - http://localhost:4873 # same thing
# - 0.0.0.0:4873 # listen on all addresses (INADDR_ANY)
# - https://example.org:4873 # if you want to use https
# - "[::1]:4873" # ipv6
# - unix:/tmp/verdaccio.sock # unix socket
# The HTTPS configuration is useful if you do not consider use a HTTP Proxy
# https://verdaccio.org/docs/configuration#https
# https:
# key: ./path/verdaccio-key.pem
# cert: ./path/verdaccio-cert.pem
# ca: ./path/verdaccio-csr.pem
# https://verdaccio.org/docs/configuration#proxy
# http_proxy: http://something.local/
# https_proxy: https://something.local/
# https://verdaccio.org/docs/configuration#notifications
# notify:
# method: POST
# headers: [{ "Content-Type": "application/json" }]
# endpoint: https://usagge.hipchat.com/v2/room/3729485/notification?auth_token=mySecretToken
# content: '{"color":"green","message":"New package published: * {{ name }}*","notify":true,"message_format":"text"}'
middlewares:
audit:
enabled: true
# https://verdaccio.org/docs/logger
# log settings
logs: { type: stdout, format: pretty, level: http }
#experiments:
# # support for npm token command
# token: false
# # enable tarball URL redirect for hosting tarball with a different server, the tarball_url_redirect can be a template string
# tarball_url_redirect: 'https://mycdn.com/verdaccio/${packageName}/${filename}'
# # the tarball_url_redirect can be a function, takes packageName and filename and returns the url, when working with a js configuration file
# tarball_url_redirect(packageName, filename) {
# const signedUrl = // generate a signed url
# return signedUrl;
# }
# translate your registry, api i18n not available yet
# i18n:
# list of the available translations https://github.com/verdaccio/verdaccio/blob/master/packages/plugins/ui-theme/src/i18n/ABOUT_TRANSLATIONS.md
# web: en-US
文件目錄分級(jí)如下:
[root@localhost data]# tree /lianxi
/lianxi
├── docker-compose.yml
└── verdaccio
├── config
│?? └── config.yaml
├── plugins
└── storage
授權(quán),否則會(huì)報(bào)錯(cuò) :Verdaccio在容器中以非根用戶(uid=10001)的身份運(yùn)行,要授權(quán),否則會(huì)權(quán)限錯(cuò)誤
[root@test5 config]# cd /lianxi
[root@test5 lianxi]# chown -R 10001:65533 ./verdaccio/storage/
編寫docker-compose.yml文件:
我是將docker-compose.yml文件存放在/lianxi下,注意存放路徑,這根yml文件內(nèi)部的映射有很大關(guān)系,不能弄錯(cuò)
[root@test5 lianxi]# vim docker-compose.yml
[root@test5 lianxi]# cat docker-compose.yml
version: '3'
services:
verdaccio:
image: verdaccio/verdaccio
container_name: "verdaccio"
environment:
- VERDACCIO_PORT=4873
ports:
- "4873:4873"
volumes:
- "./verdaccio/storage:/verdaccio/storage"
- "./verdaccio/config:/verdaccio/conf"
- "./verdaccio/plugins:/verdaccio/plugins"
networks:
node-network:
driver: bridge
開(kāi)始安裝
[root@test5 lianxi]# docker-compose up -d
WARNING: Some networks were defined but are not used by any service: node-network
WARNING: Found orphan containers (nginx) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
Creating verdaccio ... done
[root@test5 lianxi]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
34d9754ae6e9 verdaccio/verdaccio "uid_entrypoint /bin…" 10 seconds ago Up 9 seconds 0.0.0.0:4873->4873/tcp, :::4873->4873/tcp verdaccio
進(jìn)入容器內(nèi)部查看
[root@test5 lianxi]# docker exec -it verdaccio /bin/bash #bash進(jìn)不去,只有sh可以進(jìn)去
OCI runtime exec failed: exec failed: unable to start container process: exec: "/bin/bash": stat /bin/bash: no such file or directory: unknown
[root@test5 lianxi]# docker exec -it verdaccio /bin/sh
~ $ cd /verdaccio/conf/
/verdaccio/conf $ ls
config.yaml
/verdaccio/conf $
容器成功起來(lái)之后就可以在web界面上訪問(wèn)了,界面如下圖所示:
?
verdaccio的配置文件解讀:
# 所有包的保存路徑
storage: /verdaccio/storage/data
# 插件的保存路徑
plugins: /verdaccio/plugins
# 通過(guò)web訪問(wèn)
web:
title: Verdaccio
# 賬號(hào)密碼文件,初始不存在
auth:
htpasswd:
file: /verdaccio/storage/htpasswd
# max_users:1000
# 默認(rèn)1000,允許用戶注冊(cè)數(shù)量。為-1時(shí),不能通過(guò) npm adduser 注冊(cè),此時(shí)可以直接修改 file 文件添加用戶。
# 本地不存在時(shí),讀取倉(cāng)庫(kù)的地址
uplinks:
npmjs:
url: https://registry.npmjs.org
# 對(duì)包的訪問(wèn)操作權(quán)限,可以匹配某個(gè)具體項(xiàng)目,也可以通配
# access 訪問(wèn)下載;publish 發(fā)布;unpublish 取消發(fā)布;
# proxy 對(duì)應(yīng)著uplinks名稱,本地不存在,去unplinks里取
# $all 表示所有人都可以執(zhí)行該操作
# $authenticated 已注冊(cè)賬戶可操作
# $anonymous 匿名用戶可操作
# 還可以明確指定 htpasswd 用戶表中的用戶,可以配置一個(gè)或多個(gè)。
packages:
'@*/*':
access: $all
publish: $authenticated
unpublish: $authenticated
proxy: npmjs
'**':
access: $all
publish: $authenticated
unpublish: $authenticated
proxy: npmjs
# 服務(wù)器相關(guān)
sever:
keepAliveTimeout: 60
middlewares:
audit:
enabled: true
# 日志設(shè)定
logs: { type: stdout, format: pretty, level: http }
原文鏈接:https://blog.csdn.net/weixin_43880061/article/details/127287262
相關(guān)推薦
- 2022-06-18 android實(shí)現(xiàn)在圖標(biāo)上顯示數(shù)字_Android
- 2022-11-02 React+Mobx基本使用、模塊化操作_React
- 2022-09-22 String和StringBuilder的用法
- 2023-04-19 Android使用gradle讀取并保存數(shù)據(jù)到BuildConfg流程詳解_Android
- 2022-12-26 詳解Python中四種關(guān)系圖數(shù)據(jù)可視化的效果對(duì)比_python
- 2023-07-29 iview的表格實(shí)現(xiàn)單元格行編輯功能
- 2022-10-04 混合棧跳轉(zhuǎn)導(dǎo)致Flutter頁(yè)面事件卡死問(wèn)題解決_IOS
- 2022-08-10 淺談pandas關(guān)于查看庫(kù)或依賴庫(kù)版本的API原理_python
- 最近更新
-
- window11 系統(tǒng)安裝 yarn
- 超詳細(xì)win安裝深度學(xué)習(xí)環(huán)境2025年最新版(
- Linux 中運(yùn)行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲(chǔ)小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎(chǔ)操作-- 運(yùn)算符,流程控制 Flo
- 1. Int 和Integer 的區(qū)別,Jav
- spring @retryable不生效的一種
- Spring Security之認(rèn)證信息的處理
- Spring Security之認(rèn)證過(guò)濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權(quán)
- redisson分布式鎖中waittime的設(shè)
- maven:解決release錯(cuò)誤:Artif
- restTemplate使用總結(jié)
- Spring Security之安全異常處理
- MybatisPlus優(yōu)雅實(shí)現(xiàn)加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務(wù)發(fā)現(xiàn)-Nac
- Spring Security之基于HttpR
- Redis 底層數(shù)據(jù)結(jié)構(gòu)-簡(jiǎn)單動(dòng)態(tài)字符串(SD
- arthas操作spring被代理目標(biāo)對(duì)象命令
- Spring中的單例模式應(yīng)用詳解
- 聊聊消息隊(duì)列,發(fā)送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠(yuǎn)程分支