mirror of
https://github.com/tun2proxy/tun2proxy.git
synced 2025-04-19 21:39:09 +00:00
docker-compose.yaml support
This commit is contained in:
parent
46bf4434ef
commit
de50c1402a
1 changed files with 32 additions and 1 deletions
33
README.md
33
README.md
|
@ -172,7 +172,8 @@ Currently, tun2proxy supports HTTP, SOCKS4/SOCKS4a and SOCKS5. A proxy is suppli
|
|||
URL format. For example, an HTTP proxy at `1.2.3.4:3128` with a username of `john.doe` and a password of `secret` is
|
||||
supplied as `--proxy http://john.doe:secret@1.2.3.4:3128`. This works analogously to curl's `--proxy` argument.
|
||||
|
||||
## Docker Support
|
||||
## Container Support
|
||||
### Docker
|
||||
Tun2proxy can serve as a proxy for other Docker containers. To make use of that feature, first build the image:
|
||||
|
||||
```bash
|
||||
|
@ -197,6 +198,36 @@ docker run -it \
|
|||
--network "container:tun2proxy" \
|
||||
ubuntu:latest
|
||||
```
|
||||
### Docker Compose
|
||||
|
||||
The above docker command is written into a `docker-compose.yaml` file.
|
||||
|
||||
```yaml
|
||||
services:
|
||||
tun2proxy:
|
||||
volumes:
|
||||
- /dev/net/tun:/dev/net/tun
|
||||
sysctls:
|
||||
- net.ipv6.conf.default.disable_ipv6=0
|
||||
cap_add:
|
||||
- NET_ADMIN
|
||||
container_name: tun2proxy
|
||||
image: ghcr.io/tun2proxy/tun2proxy:latest
|
||||
command: --proxy proto://[username[:password]@]host:port
|
||||
alpine:
|
||||
stdin_open: true
|
||||
tty: true
|
||||
network_mode: container:tun2proxy
|
||||
image: alpine:latest
|
||||
command: apk add curl && curl ifconfig.icu && sleep 10
|
||||
```
|
||||
|
||||
run compose file
|
||||
|
||||
```bash
|
||||
docker compose up -d tun2proxy
|
||||
docker compose up alpine
|
||||
```
|
||||
|
||||
## Configuration Tips
|
||||
### DNS
|
||||
|
|
Loading…
Add table
Reference in a new issue