0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-01-20 22:52:46 -05:00

moving docker section to new wiki folder

This commit is contained in:
Christian Bewernitz 2017-06-24 11:59:25 +02:00
parent 9a4f81c2cb
commit 8cfd437b7e
4 changed files with 126 additions and 109 deletions

112
README.md
View file

@ -62,32 +62,16 @@ When you start a server, it auto-creates a config file.
### Docker ### Docker
Below are the most commony needed informations,
every aspect of Docker and verdaccio is [documented separately](wiki/docker.md)
#### Prebuilt images #### Prebuilt images
To pull the latest pre-built [docker image](https://hub.docker.com/r/verdaccio/verdaccio/): To pull the latest pre-built [docker image](https://hub.docker.com/r/verdaccio/verdaccio/):
`docker pull verdaccio/verdaccio` `docker pull verdaccio/verdaccio`
##### Tagged Versions Since version 2 images for every versions are availabel as [tags](https://hub.docker.com/r/verdaccio/verdaccio/tags/).
Since version `v2.x` you can pull docker images by [tag](https://hub.docker.com/r/verdaccio/verdaccio/tags/), as follows:
For a major version:
```bash
docker pull verdaccio/verdaccio:2
```
For a minor version:
```bash
docker pull verdaccio/verdaccio:2.1
```
For a specific (patch) version:
```bash
docker pull verdaccio/verdaccio:2.1.7
```
#### Running verdaccio using Docker #### Running verdaccio using Docker
@ -95,46 +79,6 @@ To run the docker container:
```bash ```bash
docker run -it --rm --name verdaccio -p 4873:4873 verdaccio/verdaccio docker run -it --rm --name verdaccio -p 4873:4873 verdaccio/verdaccio
``` ```
The last argument defines which image to use.
The above line will pull the latest prebuilt image from dockerhub, if you haven't done that already.
If you have [build an image locally](#build-your-own-docker-image) use `verdaccio` as the last argument.
You can use `-v` to mount `conf` and `storage` to the hosts filesystem:
```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 \
verdaccio/verdaccio
```
#### Docker and custom port configuration
Any `host:port` configured in `conf/config.yaml` under `listen` is currently ignored when using docker.
If you want to reach verdaccio docker instance under different port, lets say `5000`
in your `docker run` command replace `-p 4873:4873` with `-p 5000:4873`.
In case you need to specify which port to listen to **in the docker container**,
since version 2.?.? you can do so by providing additional arguments to `docker run`: `--env PORT=5000`
This changes which port the docker container exposes and the port verdaccio listens to.
Of course the numbers you give to `-p` paremeter need to match,
so assuming you want them to all be the same this is what you could copy, paste and adopt:
```bash
PORT=5000; docker run -it --rm --name verdaccio \
--env PORT -p $PORT:$PORT
verdaccio/verdaccio
```
To run the docker container:
```bash
docker run -it --rm --name verdaccio -p 4873:4873 \
-v /<path to verdaccio directory>/conf:/verdaccio/conf \
-v /<path to verdaccio directory>/storage:/verdaccio/storage \
verdaccio/verdaccio
```
Note: The build might take some minutes to build locally.
#### Using docker-compose #### Using docker-compose
@ -145,54 +89,6 @@ Note: The build might take some minutes to build locally.
$ docker-compose up --build $ docker-compose up --build
``` ```
You can set the port to use (for both comtainer and host) by prefixing the above command with `PORT=5000 `.
Docker will generate a named volume in which to store persistent application data. You can use `docker inspect` or `docker volume inspect` to reveal the physical location of the volume and edit the configuration, such as:
```
$ docker volume inspect verdaccio_verdaccio
[
{
"Name": "verdaccio_verdaccio",
"Driver": "local",
"Mountpoint": "/var/lib/docker/volumes/verdaccio_verdaccio/_data",
"Labels": null,
"Scope": "local"
}
]
```
#### Build your own Docker image
```bash
docker build -t verdaccio .
```
There is also an npm script for building the docker image, so you can also do:
```bash
npm run build-docker
```
Note: The first build takes some minutes to build because it needs to run `npm install`,
and it will take that long again whenever you change any file that is not listed in `.dockerignore`.
If you want to use the docker image on a rpi or a compatible device there is also a dockerfile available.
To build the docker image for raspberry pi execute:
```bash
npm run build-docker:rpi
```
Please note that for any of the above docker commands you need to have docker installed on your machine and the docker executable should be available on your `$PATH`.
##### Docker Examples
This repository host multiple configurations to compose Docker images with `verdaccio`, for instance, as reverse proxy.
[https://github.com/verdaccio/docker-examples](https://github.com/verdaccio/docker-examples)
### Ansible ### Ansible
A Verdaccio playbook [is available at galaxy](https://galaxy.ansible.com/030/verdaccio) source: https://github.com/030/ansible-verdaccio A Verdaccio playbook [is available at galaxy](https://galaxy.ansible.com/030/verdaccio) source: https://github.com/030/ansible-verdaccio

View file

@ -4,7 +4,7 @@
# #
# Do not configure host and port under `listen` in this file # Do not configure host and port under `listen` in this file
# as it will be ignored when using docker. # as it will be ignored when using docker.
# see https://github.com/verdaccio/verdaccio#docker-and-custom-port-configuration # see https://github.com/verdaccio/verdaccio/blob/master/wiki/docker.md#docker-and-custom-port-configuration
# #
# Look here for more config file examples: # Look here for more config file examples:
# https://github.com/verdaccio/verdaccio/tree/master/conf # https://github.com/verdaccio/verdaccio/tree/master/conf

View file

@ -24,6 +24,7 @@ from a fresh look at the code and the outstanding issues. So here we are 🎉
## DevOps ## DevOps
* [Ansible](ansible.md) * [Ansible](ansible.md)
* [Docker](docker.md)
## Extends Verdaccio ## Extends Verdaccio

120
wiki/docker.md Normal file
View file

@ -0,0 +1,120 @@
# Prebuilt images
To pull the latest pre-built [docker image](https://hub.docker.com/r/verdaccio/verdaccio/):
`docker pull verdaccio/verdaccio`
## Tagged Versions
Since version `v2.x` you can pull docker images by [tag](https://hub.docker.com/r/verdaccio/verdaccio/tags/), as follows:
For a major version:
```bash
docker pull verdaccio/verdaccio:2
```
For a minor version:
```bash
docker pull verdaccio/verdaccio:2.1
```
For a specific (patch) version:
```bash
docker pull verdaccio/verdaccio:2.1.7
```
# Running verdaccio using Docker
To run the docker container:
```bash
docker run -it --rm --name verdaccio -p 4873:4873 verdaccio/verdaccio
```
The last argument defines which image to use.
The above line will pull the latest prebuilt image from dockerhub, if you haven't done that already.
If you have [build an image locally](#build-your-own-docker-image) use `verdaccio` as the last argument.
You can use `-v` to mount `conf` and `storage` to the hosts filesystem:
```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 \
verdaccio/verdaccio
```
## Docker and custom port configuration
Any `host:port` configured in `conf/config.yaml` under `listen` is currently ignored when using docker.
If you want to reach verdaccio docker instance under different port, lets say `5000`
in your `docker run` command replace `-p 4873:4873` with `-p 5000:4873`.
In case you need to specify which port to listen to **in the docker container**,
since version 2.?.? you can do so by providing additional arguments to `docker run`: `--env PORT=5000`
This changes which port the docker container exposes and the port verdaccio listens to.
Of course the numbers you give to `-p` paremeter need to match,
so assuming you want them to all be the same this is what you could copy, paste and adopt:
```bash
PORT=5000; docker run -it --rm --name verdaccio \
--env PORT -p $PORT:$PORT
verdaccio/verdaccio
```
## Using docker-compose
1. Get the latest version of [docker-compose](https://github.com/docker/compose).
2. Build and run the container:
```bash
$ docker-compose up --build
```
You can set the port to use (for both comtainer and host) by prefixing the above command with `PORT=5000 `.
Docker will generate a named volume in which to store persistent application data. You can use `docker inspect` or `docker volume inspect` to reveal the physical location of the volume and edit the configuration, such as:
```
$ docker volume inspect verdaccio_verdaccio
[
{
"Name": "verdaccio_verdaccio",
"Driver": "local",
"Mountpoint": "/var/lib/docker/volumes/verdaccio_verdaccio/_data",
"Labels": null,
"Scope": "local"
}
]
```
# Build your own Docker image
```bash
docker build -t verdaccio .
```
There is also an npm script for building the docker image, so you can also do:
```bash
npm run build-docker
```
Note: The first build takes some minutes to build because it needs to run `npm install`,
and it will take that long again whenever you change any file that is not listed in `.dockerignore`.
If you want to use the docker image on a rpi or a compatible device there is also a dockerfile available.
To build the docker image for raspberry pi execute:
```bash
npm run build-docker:rpi
```
Please note that for any of the above docker commands you need to have docker installed on your machine and the docker executable should be available on your `$PATH`.
# Docker Examples
There is a separate repository that hosts multiple configurations to compose Docker images with `verdaccio`, for instance, as reverse proxy:
https://github.com/verdaccio/docker-examples