mirror of
https://github.com/teddysun/across.git
synced 2025-01-31 12:19:35 +08:00
Added V2Ray Docker Image
This commit is contained in:
parent
f2f3006c75
commit
34cce27c16
34
docker/v2ray/Dockerfile
Normal file
34
docker/v2ray/Dockerfile
Normal file
@ -0,0 +1,34 @@
|
||||
# Dockerfile for v2ray based alpine
|
||||
# Copyright (C) 2019 Teddysun <i@teddysun.com>
|
||||
# Reference URL:
|
||||
# https://github.com/v2ray/v2ray-core
|
||||
|
||||
FROM golang:alpine AS builder
|
||||
RUN set -ex \
|
||||
&& apk add --no-cache git build-base \
|
||||
&& mkdir -p /go/src/github.com/v2ray \
|
||||
&& cd /go/src/github.com/v2ray \
|
||||
&& git clone https://github.com/v2ray/v2ray-core.git \
|
||||
&& cd v2ray-core \
|
||||
&& go get -d \
|
||||
&& cd main \
|
||||
&& go build -o /go/bin/v2ray \
|
||||
&& cd ../infra/control/main \
|
||||
&& go build -o /go/bin/v2ctl
|
||||
|
||||
FROM alpine:latest
|
||||
LABEL maintainer="Teddysun <i@teddysun.com>"
|
||||
|
||||
RUN set -ex \
|
||||
&& apk add --no-cache tzdata ca-certificates \
|
||||
&& mkdir -p /etc/v2ray \
|
||||
&& mkdir -p /var/log/v2ray
|
||||
|
||||
COPY --from=builder /go/bin/v2ray /usr/bin
|
||||
COPY --from=builder /go/bin/v2ctl /usr/bin
|
||||
COPY config.json /etc/v2ray/config.json
|
||||
VOLUME /etc/v2ray
|
||||
|
||||
ENV TZ=Asia/Shanghai
|
||||
|
||||
CMD [ "v2ray", "-config", "/etc/v2ray/config.json" ]
|
75
docker/v2ray/README.md
Normal file
75
docker/v2ray/README.md
Normal file
@ -0,0 +1,75 @@
|
||||
## V2Ray Docker Image by Teddysun
|
||||
|
||||
[V2Ray][1] is a platform for building proxies to bypass network restrictions.
|
||||
|
||||
It secures your network connections and thus protects your privacy.
|
||||
|
||||
Docker images are built for quick deployment in various computing cloud providers.
|
||||
|
||||
For more information on docker and containerization technologies, refer to [official document][2].
|
||||
|
||||
## Prepare the host
|
||||
|
||||
If you need to install docker by yourself, follow the [official installation guide][3].
|
||||
|
||||
## Pull the image
|
||||
|
||||
```bash
|
||||
$ docker pull teddysun/v2ray
|
||||
```
|
||||
|
||||
This pulls the latest release of V2Ray.
|
||||
|
||||
It can be found at [Docker Hub][4].
|
||||
|
||||
## Start a container
|
||||
|
||||
You **must create a configuration file** `/etc/v2ray/config.json` in host at first:
|
||||
|
||||
```
|
||||
$ mkdir -p /etc/v2ray
|
||||
```
|
||||
|
||||
A sample in JSON like below:
|
||||
|
||||
```
|
||||
{
|
||||
"log" : {
|
||||
"access": "/var/log/v2ray/access.log",
|
||||
"error": "/var/log/v2ray/error.log",
|
||||
"loglevel": "warning"
|
||||
},
|
||||
"inbounds": [{
|
||||
"port": 9000,
|
||||
"protocol": "vmess",
|
||||
"settings": {
|
||||
"clients": [
|
||||
{
|
||||
"id": "11c2a696-0366-4524-b8f0-9a9c21512b02",
|
||||
"level": 1,
|
||||
"alterId": 64
|
||||
}
|
||||
]
|
||||
}
|
||||
}],
|
||||
"outbounds": [{
|
||||
"protocol": "freedom",
|
||||
"settings": {}
|
||||
}]
|
||||
}
|
||||
```
|
||||
|
||||
Or generate a configuration file online by [https://tools.sprov.xyz/v2ray/](https://tools.sprov.xyz/v2ray/)
|
||||
|
||||
There is an example to start a container that listen on port `9000`, run as a V2Ray server like below:
|
||||
|
||||
```bash
|
||||
$ docker run -d -p 9000:9000 --name v2ray --restart=always -v /etc/v2ray:/etc/v2ray teddysun/v2ray
|
||||
```
|
||||
|
||||
**Warning**: The port number must be same as configuration and opened in firewall.
|
||||
|
||||
[1]: https://github.com/v2ray/v2ray-core
|
||||
[2]: https://docs.docker.com/
|
||||
[3]: https://docs.docker.com/install/
|
||||
[4]: https://hub.docker.com/r/teddysun/v2ray/
|
24
docker/v2ray/config.json
Normal file
24
docker/v2ray/config.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"log" : {
|
||||
"access": "/var/log/v2ray/access.log",
|
||||
"error": "/var/log/v2ray/error.log",
|
||||
"loglevel": "warning"
|
||||
},
|
||||
"inbounds": [{
|
||||
"port": 9000,
|
||||
"protocol": "vmess",
|
||||
"settings": {
|
||||
"clients": [
|
||||
{
|
||||
"id": "11c2a696-0366-4524-b8f0-9a9c21512b02",
|
||||
"level": 1,
|
||||
"alterId": 64
|
||||
}
|
||||
]
|
||||
}
|
||||
}],
|
||||
"outbounds": [{
|
||||
"protocol": "freedom",
|
||||
"settings": {}
|
||||
}]
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user