centOS 6.8 安装 docker以及verdaccio
安装
yum install https://get.docker.com/rpm/1.7.1/centos-6/RPMS/x86_64/docker-engine-1.7.1-1.el6.x86_64.rpm
PS:
网上的另一种方法
更新epel第三方软件库,运行命令:sudo yum install epel-release ,之后再执行:sudo yum install docker
我还是一样的报错,并没有解决问题
No package docker-io available.
错误:无须任何处理
运行
docker run -d -it --rm --name verdaccio -p 4873:4873 verdaccio/verdaccio
运行后报错了,说 -d 和 -rm 冲突,于是删去了 -rm
docker run -d -it --name verdaccio -p 4873:4873 verdaccio/verdaccio
docker run
docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
参数介绍
- -d:使用-d参数,使容器在后台运行。
- -i:以交互模式运行容器,通常与 -t 同时使用;
- -t:为容器重新分配一个伪输入终端,通常与 -i 同时使用;
- --name="nginx-lb": 为容器指定一个名称;
- -p: 指定端口映射,格式为:主机(宿主)端口:容器端口
查看
docker ps
查看当前运行的容器 -a 查看所有
进入容器 (root 权限)
docker exec -it -u root cd122ea657d6 /bin/sh
配置文件位置
配置文件内容
#
# This is the config file used for the docker images.
# It allows all users to do anything, so don't use it on production systems.
#
# 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/master/conf
#
# path to a directory with all packages
storage: /verdaccio/storage/data
# path to a directory with plugins to include
plugins: /verdaccio/plugins
web:
# WebUI is enabled as default, if you want disable it, just uncomment this line
#enable: false
title: Verdaccio
# comment out to disable gravatar support
# gravatar: false
# by default packages are ordercer ascendant (asc|desc)
# sort_packages: asc
# darkMode: true
# translate your registry, api i18n not available yet
# i18n:
# list of the available translations https://github.com/verdaccio/ui/tree/master/i18n/translations
# web: en-US
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
# a list of other known repositories we can talk to
uplinks:
npmjs:
url: https://registry.npmjs.org/
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
middlewares:
audit:
enabled: true
# log settings
logs:
- { type: stdout, format: pretty, level: http }
#- {type: file, path: verdaccio.log, level: info}
#experiments:
# # support for npm token command
# token: false
# # support for the new v1 search endpoint, functional by incomplete read more on ticket 1732
# search: false
# This affect the web and api (not developed yet)
#i18n:
#web: en-US
修改上行链路
#
# This is the config file used for the docker images.
# It allows all users to do anything, so don't use it on production systems.
#
# 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/master/conf
#
# path to a directory with all packages
storage: /verdaccio/storage/data
# path to a directory with plugins to include
plugins: /verdaccio/plugins
web:
# WebUI is enabled as default, if you want disable it, just uncomment this line
#enable: false
title: Verdaccio
# comment out to disable gravatar support
# gravatar: false
# by default packages are ordercer ascendant (asc|desc)
# sort_packages: asc
# darkMode: true
# translate your registry, api i18n not available yet
# i18n:
# list of the available translations https://github.com/verdaccio/ui/tree/master/i18n/translations
# web: en-US
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
# a list of other known repositories we can talk to
uplinks:
npmjs:
url: https://registry.npmjs.org/
cnpmjs:
url: https://registry.npm.taobao.org/
packages:
'@*/*':
# scoped packages
access: $all
publish: $authenticated
unpublish: $authenticated
proxy: cnpmjs
'**':
# 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 'cnpmjs' registry
proxy: cnpmjs
middlewares:
audit:
enabled: true
# log settings
logs:
- { type: stdout, format: pretty, level: http }
#- {type: file, path: verdaccio.log, level: info}
#experiments:
# # support for npm token command
# token: false
# # support for the new v1 search endpoint, functional by incomplete read more on ticket 1732
# search: false
# This affect the web and api (not developed yet)
#i18n:
#web: en-US
docker run -itd --name verdaccioTest2 -p 4873:4873 -v /home/cheri/verdaccio/conf:/verdaccio/conf -v /home/cheri/verdaccio/storage:/verdaccio/storage verdaccio/verdaccio
注意
npm 包和账号信息
如果没有额外配置 -v 的话,用户信息和包信息会随着 docker rm 删除容器而一起消失
73644425a13ce.svg', bytes: 0/0
2020-09-04T09:09:47.549386371Z http <-- 304, user: null(192.168.63.189 via 192.168.52.41), req: 'GET /-/static/ac0877b3e5dab78d7b5319b32cb03b11.svg', bytes: 0/0
2020-09-04T09:09:47.549386371Z http <-- 304, user: null(192.168.63.189 via 192.168.52.41), req: 'GET /-/static/ac0877b3e5dab78d7b5319b32cb03b11.svg', bytes: 0/0
2020-09-04T09:09:47.559378330Z http <-- 304, user: null(192.168.63.189 via 192.168.52.41), req: 'GET /-/static/93df1ce974e744e7d98f5d842da74ba0.svg', bytes: 0/0
2020-09-04T09:09:47.560453611Z http <-- 304, user: null(192.168.63.189 via 192.168.52.41), req: 'GET /-/static/93df1ce974e744e7d98f5d842da74ba0.svg', bytes: 0/0
2020-09-04T09:09:47.583386742Z http <-- 304, user: null(192.168.63.189 via 192.168.52.41), req: 'GET /-/static/24fd3a77ee5710ead382075bbfa36d17.svg', bytes: 0/0
2020-09-04T09:09:47.583386742Z http <-- 304, user: null(192.168.63.189 via 192.168.52.41), req: 'GET /-/static/24fd3a77ee5710ead382075bbfa36d17.svg', bytes: 0/0
2020-09-04T09:09:47.587379314Z http <-- 304, user: null(192.168.63.189 via 192.168.52.41), req: 'GET /-/static/6f6560222974090c1ef11e84623ff803.svg', bytes: 0/0
2020-09-04T09:09:47.587379314Z http <-- 304, user: null(192.168.63.189 via 192.168.52.41), req: 'GET /-/static/6f6560222974090c1ef11e84623ff803.svg', bytes: 0/0
2020-09-04T09:09:47.589383248Z http <-- 304, user: null(192.168.63.189 via 192.168.52.41), req: 'GET /-/static/ee698c70f8c67df1d710081ab8fc41a2.svg', bytes: 0/0
2020-09-04T09:09:47.589383248Z http <-- 304, user: null(192.168.63.189 via 192.168.52.41), req: 'GET /-/static/ee698c70f8c67df1d710081ab8fc41a2.svg', bytes: 0/0
2020-09-04T09:09:47.590454772Z http <-- 304, user: null(192.168.63.189 via 192.168.52.41), req: 'GET /-/static/75b39b2fd2bf8343d4ba4743ba3d
adduser时 没有反应
需要授权
chmod -R 777 verdaccio/storage