Browse Source

docker-compose.yaml support (#166)

pull/168/head
Paper-Dragon 2 years ago
committed by GitHub
parent
commit
724557b30e
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 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 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:[email protected]:3128`. This works analogously to curl's `--proxy` argument. supplied as `--proxy http://john.doe:[email protected]: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: Tun2proxy can serve as a proxy for other Docker containers. To make use of that feature, first build the image:
```bash ```bash
@ -197,6 +198,36 @@ docker run -it \
--network "container:tun2proxy" \ --network "container:tun2proxy" \
ubuntu:latest 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 ## Configuration Tips
### DNS ### DNS

Loading…
Cancel
Save