mirror of
https://github.com/cedar2025/hysteria.git
synced 2025-06-30 16:29:58 +00:00
docs(docker): add docker docs
add docker docs Signed-off-by: mritd <mritd@linux.com>
This commit is contained in:
parent
66f9cc9e83
commit
0eb640252c
64
Docker.md
Normal file
64
Docker.md
Normal file
@ -0,0 +1,64 @@
|
||||
## About Dockerfile
|
||||
|
||||
The hysteria docker image is based on the **alpine** system. This means that
|
||||
**some glibc calls may not work if you run programs that depend on glibc in a container.**
|
||||
|
||||
By default, **bash** is installed in the docker container for debugging, **tzdata** is used to
|
||||
provide container time zone configuration, and **ca-certificates** is used to ensure the
|
||||
trust of the ssl certificate chain; in addition, the docker container does not contain
|
||||
any tools other than the alpine standard system.
|
||||
|
||||
The hysteria binary is installed in `/usr/local/bin/hysteria`, and the **ENTRYPOINT**
|
||||
of the docker container is set to **execute the `hysteria` command**; this means that
|
||||
the `hysteria` command is always the first command.
|
||||
|
||||
## How to use docker image?
|
||||
|
||||
### For standard docker users
|
||||
|
||||
You can mount the configuration file to any location of the docker container and use it.
|
||||
|
||||
In the following commands, we assume that the **`/root/hysteria.json`** configuration
|
||||
file is mounted to **`/etc/hysteria.json`**:
|
||||
|
||||
```sh
|
||||
# Please replace `/root/hysteria.json` with the actual configuration file location
|
||||
docker run -dt --name hysteria \
|
||||
-v /root/hysteria.json:/etc/hysteria.json \
|
||||
tobyxdd/hysteria -config /etc/hysteria.json server
|
||||
```
|
||||
|
||||
### For docker-compose users
|
||||
|
||||
First, you need to create a directory with any name, and then copy [docker-compise.yaml](https://raw.githubusercontent.com/HyNetwork/hysteria/master/docker-compose.yaml) to
|
||||
that directory. Finally, create your configuration file and start it.
|
||||
|
||||
```sh
|
||||
# Create dir
|
||||
mkdir hysteria && cd hysteria
|
||||
|
||||
# Download the docker-compose example config
|
||||
wget https://raw.githubusercontent.com/HyNetwork/hysteria/master/docker-compose.yaml
|
||||
|
||||
# Create your config
|
||||
cat <<EOF > hysteria.json
|
||||
{
|
||||
"listen": ":36712",
|
||||
"acme": {
|
||||
"domains": [
|
||||
"your.domain.com"
|
||||
],
|
||||
"email": "hacker@gmail.com"
|
||||
},
|
||||
"obfs": "fuck me till the daylight",
|
||||
"up_mbps": 100,
|
||||
"down_mbps": 100
|
||||
}
|
||||
EOF
|
||||
|
||||
# Start container
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
|
||||
|
60
Docker.zh.md
Normal file
60
Docker.zh.md
Normal file
@ -0,0 +1,60 @@
|
||||
## 关于 Dockerfile
|
||||
|
||||
hysteria 的 docker 镜像基于 **alpine** 系统,这意味着如果您在容器里运行一些依赖于 glibc
|
||||
的自定义程序可能会失败。
|
||||
|
||||
默认情况下容器内安装了 **`bash`** 用于调试目的,安装的 **`tzdata`** 用于提供容器的时区信息;
|
||||
为了保证 ACME 等连其他网站时 SSL 证书信任还安装了 **`ca-certificates`**;除此之外容器内不包含
|
||||
任何非标准 alpine 系统的其他工具。
|
||||
|
||||
hysteria 二进制可执行文件默认被安装到 `/usr/local/bin/hysteria`,同时容器的 **ENTRYPOINT**
|
||||
被设置为**执行 `hysteria` 命令**;这意味着在不进行覆盖的情况下容器启动后首先将执行 `hysteria`
|
||||
命令。
|
||||
|
||||
## 如何使用本镜像?
|
||||
|
||||
### 标准 Docker 用户
|
||||
|
||||
您可以将配置文件挂载到容器内的任何位置然后使用它。
|
||||
|
||||
在下面的命令中我们假设将 **`/root/hysteria.json`** 配置文件挂载为容器内的 **`/etc/hysteria.json`** 文件。
|
||||
|
||||
```sh
|
||||
# Please replace `/root/hysteria.json` with the actual configuration file location
|
||||
docker run -dt --name hysteria \
|
||||
-v /root/hysteria.json:/etc/hysteria.json \
|
||||
tobyxdd/hysteria -config /etc/hysteria.json server
|
||||
```
|
||||
|
||||
### Docker Compose 用户
|
||||
|
||||
首先您需要创建一个任意名称的目录,然后将项目内的 [docker-compise.yaml](https://raw.githubusercontent.com/HyNetwork/hysteria/master/docker-compose.yaml) 文件复制到该目录;
|
||||
最后创建自己的配置文件并启动即可。
|
||||
|
||||
```sh
|
||||
# Create dir
|
||||
mkdir hysteria && cd hysteria
|
||||
|
||||
# Download the docker-compose example config
|
||||
wget https://raw.githubusercontent.com/HyNetwork/hysteria/master/docker-compose.yaml
|
||||
|
||||
# Create your config
|
||||
cat <<EOF > hysteria.json
|
||||
{
|
||||
"listen": ":36712",
|
||||
"acme": {
|
||||
"domains": [
|
||||
"your.domain.com"
|
||||
],
|
||||
"email": "hacker@gmail.com"
|
||||
},
|
||||
"obfs": "fuck me till the daylight",
|
||||
"up_mbps": 100,
|
||||
"down_mbps": 100
|
||||
}
|
||||
EOF
|
||||
|
||||
# Start container
|
||||
docker-compose up -d
|
||||
```
|
||||
|
10
docker-compose.yaml
Normal file
10
docker-compose.yaml
Normal file
@ -0,0 +1,10 @@
|
||||
version: '3.8'
|
||||
services:
|
||||
hysteria:
|
||||
image: tobyxdd/hysteria
|
||||
container_name: hysteria
|
||||
restart: always
|
||||
network_mode: "host"
|
||||
volumes:
|
||||
- ./hysteria.json:/etc/hysteria.json
|
||||
command: ["-config","/etc/hysteria.json","server"]
|
Loading…
x
Reference in New Issue
Block a user