mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-11-17 07:45:52 +01:00
70675cd523
* New translations iis-server.md (Vietnamese) docs(website): new translations * New translations iis-server.md (Vietnamese) docs(website): new translations * New translations install.md (Vietnamese) docs(website): new translations * New translations install.md (Vietnamese) docs(website): new translations * New translations install.md (Vietnamese) docs(website): new translations * New translations kubernetes.md (Vietnamese) docs(website): new translations * New translations kubernetes.md (Vietnamese) docs(website): new translations * New translations auth.md (Polish) docs(website): new translations * New translations cli.md (Polish) docs(website): new translations * New translations config.md (Polish) docs(website): new translations * New translations contributing.md (Polish) docs(website): new translations * New translations dev-plugins.md (Polish) docs(website): new translations * New translations dev-plugins.md (Polish) docs(website): new translations * New translations notifications.md (Polish) docs(website): new translations * New translations protect-your-dependencies.md (Polish) docs(website): new translations * New translations en.json (Polish) docs(website): new translations * New translations en.json (Polish) docs(website): new translations * New translations puppet.md (Polish) docs(website): new translations * New translations en.json (Polish) docs(website): new translations * New translations install.md (Vietnamese) docs(website): new translations * New translations install.md (Italian) docs(website): new translations * New translations install.md (Polish) docs(website): new translations * New translations install.md (Russian) docs(website): new translations * New translations install.md (Korean) docs(website): new translations * New translations install.md (Portuguese) docs(website): new translations * New translations install.md (Spanish) docs(website): new translations * New translations install.md (Arabic) docs(website): new translations * New translations install.md (Chinese Simplified) docs(website): new translations * New translations install.md (Portuguese, Brazilian) docs(website): new translations * New translations install.md (Japanese) docs(website): new translations * New translations install.md (French) docs(website): new translations * New translations install.md (German) docs(website): new translations * New translations kubernetes.md (Vietnamese) docs(website): new translations * New translations kubernetes.md (Vietnamese) docs(website): new translations * New translations logger.md (Vietnamese) docs(website): new translations * New translations logger.md (Vietnamese) docs(website): new translations * New translations node-api.md (Vietnamese) docs(website): new translations * New translations dev-plugins.md (Russian) docs(website): new translations * New translations dev-plugins.md (Russian) docs(website): new translations * New translations dev-plugins.md (Russian) docs(website): new translations * New translations docker.md (Russian) docs(website): new translations * New translations docker.md (Russian) docs(website): new translations * New translations docker.md (Russian) docs(website): new translations * New translations docker.md (Vietnamese) docs(website): new translations * New translations en.json (Vietnamese) docs(website): new translations * New translations en.json (Italian) docs(website): new translations * New translations en.json (Polish) docs(website): new translations * New translations en.json (Portuguese) docs(website): new translations * New translations en.json (Russian) docs(website): new translations * New translations en.json (Korean) docs(website): new translations * New translations en.json (Portuguese, Brazilian) docs(website): new translations * New translations en.json (Spanish) docs(website): new translations * New translations en.json (Chinese Simplified) docs(website): new translations * New translations en.json (German) docs(website): new translations * New translations en.json (Japanese) docs(website): new translations * New translations en.json (Arabic) docs(website): new translations * New translations en.json (French) docs(website): new translations * New translations logo.md (Arabic) docs(website): new translations * New translations logo.md (Chinese Simplified) docs(website): new translations * New translations logo.md (French) docs(website): new translations * New translations logo.md (German) docs(website): new translations * New translations logo.md (Italian) docs(website): new translations * New translations logo.md (Japanese) docs(website): new translations * New translations logo.md (Korean) docs(website): new translations * New translations logo.md (Polish) docs(website): new translations * New translations logo.md (Portuguese) docs(website): new translations * New translations logo.md (Portuguese, Brazilian) docs(website): new translations * New translations logo.md (Russian) docs(website): new translations * New translations logo.md (Spanish) docs(website): new translations * New translations logo.md (Vietnamese) docs(website): new translations * New translations web.md (Vietnamese) docs(website): new translations * New translations web.md (Italian) docs(website): new translations * New translations web.md (Polish) docs(website): new translations * New translations web.md (Russian) docs(website): new translations * New translations web.md (Portuguese) docs(website): new translations * New translations web.md (Korean) docs(website): new translations * New translations web.md (Portuguese, Brazilian) docs(website): new translations * New translations web.md (Spanish) docs(website): new translations * New translations web.md (Chinese Simplified) docs(website): new translations * New translations web.md (German) docs(website): new translations * New translations web.md (Japanese) docs(website): new translations * New translations web.md (Arabic) docs(website): new translations * New translations web.md (French) docs(website): new translations * New translations auth.md (Polish) docs(website): new translations * New translations en.json (Polish) docs(website): new translations * New translations ansible.md (Hindi) docs(website): new translations * New translations reverse-proxy.md (Hindi) docs(website): new translations * New translations logo.md (Hindi) docs(website): new translations * New translations chef.md (Hindi) docs(website): new translations * New translations puppet.md (Hindi) docs(website): new translations * New translations ci.md (Hindi) docs(website): new translations * New translations what-is-verdaccio.md (Hindi) docs(website): new translations * New translations node-api.md (Hindi) docs(website): new translations * New translations windows.md (Hindi) docs(website): new translations * New translations web.md (Hindi) docs(website): new translations * New translations use-cases.md (Hindi) docs(website): new translations * New translations uplinks.md (Hindi) docs(website): new translations * New translations test.md (Hindi) docs(website): new translations * New translations ssl.md (Hindi) docs(website): new translations * New translations server.md (Hindi) docs(website): new translations * New translations repositories.md (Hindi) docs(website): new translations * New translations auth.md (Hindi) docs(website): new translations * New translations protect-your-dependencies.md (Hindi) docs(website): new translations * New translations plugins.md (Hindi) docs(website): new translations * New translations packages.md (Hindi) docs(website): new translations * New translations notifications.md (Hindi) docs(website): new translations * New translations logger.md (Hindi) docs(website): new translations * New translations kubernetes.md (Hindi) docs(website): new translations * New translations install.md (Hindi) docs(website): new translations * New translations iis-server.md (Hindi) docs(website): new translations * New translations docker.md (Hindi) docs(website): new translations * New translations dev-plugins.md (Hindi) docs(website): new translations * New translations contributing.md (Hindi) docs(website): new translations * New translations config.md (Hindi) docs(website): new translations * New translations cli.md (Hindi) docs(website): new translations * New translations build.md (Hindi) docs(website): new translations * New translations en.json (Hindi) docs(website): new translations * New translations auth.md (Polish) docs(website): new translations * New translations auth.md (Polish) docs(website): new translations * New translations build.md (Polish) docs(website): new translations * New translations cli.md (Polish) docs(website): new translations * New translations ci.md (Polish) docs(website): new translations * New translations chef.md (Polish) docs(website): new translations * New translations config.md (Spanish) docs(website): new translations * New translations config.md (Spanish) docs(website): new translations * New translations config.md (Polish) docs(website): new translations * New translations config.md (Polish) docs(website): new translations * New translations config.md (Polish) docs(website): new translations * New translations config.md (Polish) docs(website): new translations * New translations contributing.md (Polish) docs(website): new translations * New translations contributing.md (Polish) docs(website): new translations * New translations dev-plugins.md (Polish) docs(website): new translations * New translations dev-plugins.md (Polish) docs(website): new translations * New translations dev-plugins.md (Polish) docs(website): new translations * New translations dev-plugins.md (Polish) docs(website): new translations * New translations iis-server.md (Polish) docs(website): new translations * New translations config.md (Spanish) docs(website): new translations * New translations config.md (Spanish) docs(website): new translations * New translations config.md (Spanish) docs(website): new translations * New translations logo.md (Spanish) docs(website): new translations * New translations docker.md (Spanish) docs(website): new translations * New translations web.md (Spanish) docs(website): new translations * New translations logo.md (Spanish) docs(website): new translations * New translations docker.md (Spanish) docs(website): new translations * New translations docker.md (Spanish) docs(website): new translations * New translations docker.md (Spanish) docs(website): new translations * New translations docker.md (Spanish) docs(website): new translations * New translations docker.md (Spanish) docs(website): new translations * New translations docker.md (Spanish) docs(website): new translations * New translations docker.md (Spanish) docs(website): new translations * New translations dev-plugins.md (Spanish) docs(website): new translations * New translations dev-plugins.md (Spanish) docs(website): new translations * New translations dev-plugins.md (Spanish) docs(website): new translations * New translations en.json (Italian) docs(website): new translations * New translations en.json (Polish) docs(website): new translations * New translations en.json (Vietnamese) docs(website): new translations * New translations en.json (Russian) docs(website): new translations * New translations en.json (Korean) docs(website): new translations * New translations en.json (Portuguese) docs(website): new translations * New translations en.json (Spanish) docs(website): new translations * New translations en.json (Portuguese, Brazilian) docs(website): new translations * New translations en.json (Arabic) docs(website): new translations * New translations en.json (Chinese Simplified) docs(website): new translations * New translations en.json (Japanese) docs(website): new translations * New translations en.json (French) docs(website): new translations * New translations en.json (German) docs(website): new translations * New translations en.json (Hindi) docs(website): new translations * New translations en.json (Polish) docs(website): new translations * New translations iis-server.md (Polish) docs(website): new translations * New translations iis-server.md (Polish) docs(website): new translations * New translations iis-server.md (Polish) docs(website): new translations * New translations iis-server.md (Polish) docs(website): new translations * New translations install.md (Polish) docs(website): new translations * New translations kubernetes.md (Polish) docs(website): new translations * New translations kubernetes.md (Polish) docs(website): new translations * New translations logger.md (Polish) docs(website): new translations * New translations notifications.md (Polish) docs(website): new translations * New translations packages.md (Polish) docs(website): new translations * New translations node-api.md (Polish) docs(website): new translations * New translations logo.md (Polish) docs(website): new translations * New translations config.md (Polish) docs(website): new translations * New translations docker.md (Russian) docs(website): new translations * New translations docker.md (Russian) docs(website): new translations * New translations docker.md (Russian) docs(website): new translations * New translations docker.md (Russian) docs(website): new translations * New translations docker.md (Russian) docs(website): new translations * New translations docker.md (Russian) docs(website): new translations * New translations iis-server.md (Russian) docs(website): new translations * New translations iis-server.md (Russian) docs(website): new translations * New translations iis-server.md (Russian) docs(website): new translations * New translations en.json (Korean) docs(website): new translations * New translations en.json (Korean) docs(website): new translations * New translations en.json (Korean) docs(website): new translations * New translations en.json (Korean) docs(website): new translations * New translations iis-server.md (Russian) docs(website): new translations * New translations iis-server.md (Russian) docs(website): new translations * New translations iis-server.md (Russian) docs(website): new translations * New translations install.md (Russian) docs(website): new translations * New translations install.md (Russian) docs(website): new translations * New translations contributing.md (Italian) docs(website): new translations * New translations contributing.md (Korean) docs(website): new translations * New translations contributing.md (Vietnamese) docs(website): new translations * New translations contributing.md (Hindi) docs(website): new translations * New translations contributing.md (Portuguese) docs(website): new translations * New translations contributing.md (Russian) docs(website): new translations * New translations contributing.md (Spanish) docs(website): new translations * New translations contributing.md (Arabic) docs(website): new translations * New translations contributing.md (Chinese Simplified) docs(website): new translations * New translations contributing.md (Portuguese, Brazilian) docs(website): new translations * New translations contributing.md (Japanese) docs(website): new translations * New translations contributing.md (Polish) docs(website): new translations * New translations contributing.md (French) docs(website): new translations * New translations contributing.md (German) docs(website): new translations * New translations logger.md (Italian) docs(website): new translations * New translations logger.md (Korean) docs(website): new translations * New translations logger.md (Polish) docs(website): new translations * New translations logger.md (Vietnamese) docs(website): new translations * New translations logger.md (Hindi) docs(website): new translations * New translations logger.md (Portuguese) docs(website): new translations * New translations logger.md (Russian) docs(website): new translations * New translations logger.md (Spanish) docs(website): new translations * New translations logger.md (Arabic) docs(website): new translations * New translations logger.md (Chinese Simplified) docs(website): new translations * New translations logger.md (Portuguese, Brazilian) docs(website): new translations * New translations logger.md (Japanese) docs(website): new translations * New translations logger.md (French) docs(website): new translations * New translations logger.md (German) docs(website): new translations * New translations kubernetes.md (Russian) docs(website): new translations * New translations kubernetes.md (Russian) docs(website): new translations * New translations kubernetes.md (Russian) docs(website): new translations * New translations en.json (German) docs(website): new translations * New translations en.json (German) docs(website): new translations * New translations windows.md (German) docs(website): new translations * New translations en.json (German) docs(website): new translations * New translations ansible.md (Portuguese, Brazilian) docs(website): new translations * New translations auth.md (Portuguese, Brazilian) docs(website): new translations * New translations en.json (Portuguese, Brazilian) docs(website): new translations * New translations cli.md (Vietnamese) docs(website): new translations * New translations docker.md (Vietnamese) docs(website): new translations * New translations dev-plugins.md (Vietnamese) docs(website): new translations * New translations docker.md (Vietnamese) docs(website): new translations * New translations build.md (Portuguese, Brazilian) docs(website): new translations * New translations ci.md (Portuguese, Brazilian) docs(website): new translations * New translations chef.md (Portuguese, Brazilian) docs(website): new translations * New translations auth.md (Portuguese, Brazilian) docs(website): new translations * New translations config.md (Portuguese, Brazilian) docs(website): new translations * New translations ci.md (Portuguese, Brazilian) docs(website): new translations
165 lines
7.5 KiB
Markdown
165 lines
7.5 KiB
Markdown
---
|
||
id: docker
|
||
title: Docker
|
||
---
|
||
<div class="docker-count">
|
||
![alt Docker Pulls Count](http://dockeri.co/image/verdaccio/verdaccio "Docker Pulls Count")
|
||
</div>
|
||
|
||
Để tải [hình ảnh docker mới nhất](https://hub.docker.com/r/verdaccio/verdaccio/):
|
||
|
||
```bash
|
||
docker pull verdaccio/verdaccio
|
||
```
|
||
|
||
![Docker pull](/svg/docker_verdaccio.gif)
|
||
|
||
## Những phiên bản thẻ
|
||
|
||
Bắt đầu với phiên bản `v2.x`, bạn có thể tải những hình ảnh này qua [tag](https://hub.docker.com/r/verdaccio/verdaccio/tags/), cụ thể như sau:
|
||
|
||
Đối với phiên bản chính:
|
||
|
||
```bash
|
||
docker pull verdaccio/verdaccio:3
|
||
```
|
||
|
||
Đối với phiên bản phụ:
|
||
|
||
```bash
|
||
docker pull verdaccio/verdaccio:3.0
|
||
```
|
||
|
||
Đối với một phiên bản (bản vá) cụ thể:
|
||
|
||
```bash
|
||
docker pull verdaccio/verdaccio:3.0.1
|
||
```
|
||
|
||
Phiên bản chính tiếp theo sẽ sử dụng bản `beta</code> (master branch).</p>
|
||
|
||
<pre><code class="bash">docker pull verdaccio/verdaccio:beta
|
||
`</pre>
|
||
|
||
> Nếu bạn quan tâm đến danh sách thẻ, hãy [truy cập trang web Docker](https://hub.docker.com/r/verdaccio/verdaccio/tags/).
|
||
|
||
## Sử dụng Docker để chạy verdaccio
|
||
|
||
Để chạy vùng chứa docker:
|
||
|
||
```bash
|
||
docker run -it --rm --name verdaccio -p 4873:4873 verdaccio/verdaccio
|
||
```
|
||
|
||
Tham số cuối cùng sẽ xác định hình ảnh nào cần được sử dụng. Nếu bạn chưa thử, mã trên sẽ giúp bạn tải hình ảnh mới nhất được tạo trước từ dockerhub.
|
||
|
||
Khi bạn muốn tạo [một bản sao cục bộ](#build-your-own-docker-image) hãy dùng `verdaccio` làm tham số cuối cùng.
|
||
|
||
Bạn có thể sử dụng `-v` để liên kết với `conf`, `storage` và `plugins` với hệ thống tệp host:
|
||
|
||
```bash
|
||
V_PATH=/path/for/verdaccio; docker run -it --rm --name verdaccio -p 4873:4873 \
|
||
-v $V_PATH/conf:/verdaccio/conf \
|
||
-v $V_PATH/storage:/verdaccio/storage \
|
||
-v $V_PATH/plugins:/verdaccio/plugins \
|
||
verdaccio/verdaccio
|
||
```
|
||
|
||
> Lưu ý: Verdaccio chạy như một tài khoản non-root (uid = 100, gid = 101) bên trong vùng chứa. Nếu bạn sử dụng cài đặt bind để ghi đè lên các thiết lập mặc định, bạn cần đảm bảo thư mục cài đặt tương thích với tài khoản. Trong ví dụ trên, bạn sẽ chạy `sudo chown -R 100: 101/opt /verdaccio`, nếu không bạn sẽ nhận được cảnh báo lỗi quyền truy cập khi sử dụng. Chúng tôi khuyên bạn nên [ sử dụng khối lượng docker](https://docs.docker.com/storage/volumes/) thay vì cài đặt bắt buộc.
|
||
|
||
### Những phần mềm bổ trợ
|
||
|
||
Những phần mềm bổ trợ có thể được cài đặt trong một thư mục riêng biệt và được gắn với Docker hoặc Kubernetes, tuy nhiên, bạn nên đảm bảo việc tạo các phần mềm bổ trợ bằng cách sử dụng các phụ thuộc cục bộ của cùng một dữ liệu hình ảnh như Verdaccio Dockerfile.
|
||
|
||
### Docker và cấu hình cổng tùy chỉnh
|
||
|
||
Bất kỳ một `host: port` nào sử dụng cấu hình trong `conf / config.yaml` ở `listen` sẽ bị bỏ qua khi sử dụng docker.
|
||
|
||
Nếu bạn muốn có bản sao của verdaccio docker trên một cổng khác, chẳng hạn như `5000` trong lệnh `docker run`, bạn cần thay thế `-p 4873: 4873` bằng `-p 5000: 4873`.
|
||
|
||
Bắt đầu từ phiên bản 2.?.? sẽ cho phép bạn chỉ định cổng nghe trong **docker container**. bạn có thể thực hiện thao tác này bằng cách cung cấp các tham số bổ sung cho `docker run`: `--env PORT=5000 `. Điều này sẽ thay đổi cổng được hiển thị bởi vùng chứa docker và cổng mà verdaccio sử dụng.
|
||
|
||
Tất nhiên, những tham số `-p` bạn cung cấp phải khớp, vì vậy nếu bạn muốn tất cả chúng giống nhau, bạn chỉ cần sao chép, dán và sử dụng:
|
||
|
||
```bash
|
||
PORT=5000; docker run -it --rm --name verdaccio \
|
||
--env PORT -p $PORT:$PORT
|
||
verdaccio/verdaccio
|
||
```
|
||
|
||
### Sử dụng HTTPS trong Docker
|
||
|
||
Bạn có thể cài đặt cấu hình giao thức tương tự như cấu hình cổng mà verdaccio sẽ sử dụng. Sau khi bạn xác định certificate trong config.yaml, bạn phải ghi đè giá trị mặc định ("http") trong biến môi trường ` PROTOCOL ` bằng "https".
|
||
|
||
```bash
|
||
PROTOCOL=https; docker run -it --rm --name verdaccio \
|
||
--env PROTOCOL -p 4873:4873
|
||
verdaccio/verdaccio
|
||
```
|
||
|
||
### Sử dụng docker-compose
|
||
|
||
1. Tải phiên bản mới nhất của [docker-compose](https://github.com/docker/compose).
|
||
2. Tạo và chạy vùng chứa:
|
||
|
||
```bash
|
||
$ docker-compose up --build
|
||
```
|
||
|
||
Sử dụng `PORT=5000` làm tiền tố cho lệnh trên nhằm cài đặt cổng để sử dụng (cả vùng chứa và máy chủ lưu trữ).
|
||
|
||
Docker sẽ tạo ra một ổ đĩa có tên là lưu trữ dữ liệu ứng dụng liên tục. Bạn có thể sử dụng `docker inspect` hoặc `docker volume inspect` để xác định vị trí thực của ổ đĩa này và chỉnh sửa cấu hình, ví dụ như:
|
||
|
||
$ docker volume inspect verdaccio_verdaccio
|
||
[
|
||
{
|
||
"Name": "verdaccio_verdaccio",
|
||
"Driver": "local",
|
||
"Mountpoint": "/var/lib/docker/volumes/verdaccio_verdaccio/_data",
|
||
"Labels": null,
|
||
"Scope": "local"
|
||
}
|
||
]
|
||
|
||
|
||
|
||
## Tạo hình ảnh Docker của riêng bạn
|
||
|
||
```bash
|
||
docker build -t verdaccio .
|
||
```
|
||
|
||
Ngoài ra còn có một script npm để tạo ra một hình ảnh docker, vì vậy bạn cũng có thể làm như sau:
|
||
|
||
```bash
|
||
npm run build:docker
|
||
```
|
||
|
||
Xin lưu ý rằng việc tạo hình ảnh đầu tiên mất vài phút vì nó cần phải chạy `npm install` và khi bạn thay đổi bất cứ điều gì vào bất kỳ lúc nào và không được liệt kê trong `.dockerignore` thì sẽ mất một thời gian dài để chạy các tập tin này.
|
||
|
||
Nếu bạn muốn sử dụng hình ảnh docker trên một thiết bị rpi hoặc một thiết bị tương thích khác thì cũng cần một dockerfile được tạo sẵn trước đó. Để tạo một hình ảnh docker của Raspberry Pi, bạn cần thực hiện như sau:
|
||
|
||
```bash
|
||
npm run build:docker:rpi
|
||
```
|
||
|
||
Lưu ý rằng bạn cần phải cài đặt docker trên máy của bạn để thực hiện bất kỳ lệnh docker nào ở trên, docker executable phải nằm trong `$PATH` của bạn.
|
||
|
||
## Docket ví dụ
|
||
|
||
Có một kho lưu trữ riêng biệt lưu nhiều cấu hình để tạo hình ảnh Docker với `verdaccio`, ví dụ như đối với reverse proxy:
|
||
|
||
<https://github.com/verdaccio/docker-examples>
|
||
|
||
## Tạo tùy chỉnh Docker
|
||
|
||
* [docker-verdaccio-gitlab](https://github.com/snics/docker-verdaccio-gitlab)
|
||
* [docker-verdaccio](https://github.com/deployable/docker-verdaccio)
|
||
* [docker-verdaccio-s3](https://github.com/asynchrony/docker-verdaccio-s3) Private NPM container that can backup to s3
|
||
* [docker-verdaccio-ldap](https://github.com/snadn/docker-verdaccio-ldap)
|
||
* [verdaccio-ldap](https://github.com/nathantreid/verdaccio-ldap)
|
||
* [verdaccio-compose-local-bridge](https://github.com/shingtoli/verdaccio-compose-local-bridge)
|
||
* [docker-verdaccio](https://github.com/Global-Solutions/docker-verdaccio)
|
||
* [verdaccio-docker](https://github.com/idahobean/verdaccio-docker)
|
||
* [verdaccio-server](https://github.com/andru255/verdaccio-server)
|
||
* [coldrye-debian-verdaccio](https://github.com/coldrye-docker/coldrye-debian-verdaccio) docker image providing verdaccio from coldrye-debian-nodejs. |