Files

104 lines
3.4 KiB
Markdown
Raw Permalink Normal View History

2022-06-15 00:59:52 +05:30
# Psiphon Docker
2022-06-14 18:58:34 +05:30
Docker image for Psiphon
2022-06-15 00:59:52 +05:30
Psiphon is an Internet censorship circumvention system. <br>
2025-09-14 02:47:41 +05:30
This Docker image runs the ConsoleClient from the [psiphon-tunnel-core](https://github.com/Psiphon-Labs/psiphon-tunnel-core "psiphon-tunnel-core").
2022-06-15 00:59:52 +05:30
2025-09-14 02:47:41 +05:30
> This build uses the `docker buildx` plugin with the `docker-container` driver. <br>
2022-06-23 16:45:52 +05:30
> Docker image available at [swarupsengupta2007/psiphon](https://hub.docker.com/r/swarupsengupta2007/psiphon "swarupsengupta2007/psiphon"). <br>
2022-06-15 11:29:57 +05:30
```bash
2022-06-15 01:12:15 +05:30
# Clone this repo
git clone https://github.com/swarupsengupta2007/psiphon-docker
```
2022-06-15 11:26:29 +05:30
# Building<br>
2022-06-15 00:59:52 +05:30
2025-09-14 02:47:41 +05:30
1. Ensure buildx is enabled for Docker
2022-06-15 00:59:52 +05:30
2. Create a builder instance for multi-arch
2025-09-14 02:47:41 +05:30
3. Build Docker image for current platform or multi-arch
2022-06-15 11:29:57 +05:30
```bash
2022-06-15 00:59:52 +05:30
# choose target platforms
2022-06-20 10:36:02 +05:30
TARGETS="linux/amd64,linux/386,linux/arm64,linux/arm/v7,linux/arm/v6"
2022-06-15 00:59:52 +05:30
2022-06-23 16:45:52 +05:30
# Create a builder instance if it doesn't exist
2022-06-24 15:06:37 +05:30
docker buildx create --name cross-platform --platform ${TARGETS} --use
2022-06-15 00:59:52 +05:30
2025-09-14 02:47:41 +05:30
# Build for the current platform and load to Docker image
2022-06-24 15:06:37 +05:30
docker buildx build -t <your_tag> . --load
2022-06-15 00:59:52 +05:30
2025-04-05 03:09:36 +05:30
# If not already done, install the required cross-platform emulators
docker run --privileged --rm tonistiigi/binfmt --install all
2025-09-14 02:47:41 +05:30
# run the script, this will build the image for the current platform and load it to Docker
2025-06-29 03:46:52 +05:30
./make.bash --load
```
2022-06-23 16:45:52 +05:30
Build-args available
2025-06-29 03:46:52 +05:30
|build-arg|Description|Default|
|--|--|--|
|VERSION|psiphon-tunnel-core release version|latest|
|TARGETS|\<BUIDLOS\>/\<BUILDARCH\> (Targets for cross-compilation for the build stage)|current platform|
|GO_VERSION|Go version to use for building the psiphon-tunnel-core binary|1.22.7|
2022-06-23 16:45:52 +05:30
---
2022-06-15 11:15:33 +05:30
2022-06-15 11:26:29 +05:30
# Usage
2022-06-15 00:59:52 +05:30
2022-06-15 11:28:02 +05:30
## Using docker-compose (recommended) <br>
2022-06-15 01:24:32 +05:30
```yaml
2022-06-15 00:59:52 +05:30
version: "3.5"
services:
psiphon:
image: swarupsengupta2007/psiphon:latest
container_name: psiphon
environment:
- PUID=1000
- PGID=1000
2025-06-29 03:46:52 +05:30
- HTTP_PORT=8080
- SOCKS_PORT=1080
- DEVICE_REGION=IN
- EGRESS_REGION=SG
2022-06-15 00:59:52 +05:30
volumes:
- /path/to/psiphon/config:/config
ports:
- 1080:1080
- 8080:8080
restart: unless-stopped
```
2022-06-15 11:28:02 +05:30
## Using docker-cli <br>
2022-06-15 11:29:57 +05:30
```bash
2022-06-24 15:06:37 +05:30
docker run -d \
--name psiphon \
--restart=unless-stopped \
-p 8080:8080 \
-p 1080:1080 \
2025-06-29 03:46:52 +05:30
-e HTTP_PORT=8080 \
-e SOCKS_PORT=1080 \
-e DEVICE_REGION=IN \
-e EGRESS_REGION=SG \
2022-06-24 15:06:37 +05:30
-v /home/swarup/psiphon/config/:/config \
swarupsengupta2007/psiphon
2022-06-15 11:29:57 +05:30
```
2022-06-15 00:59:52 +05:30
2025-09-14 02:47:41 +05:30
The following Environment var are available (only applicable when running for the first time with no psiphon.config in the mounted config directory)<br>
2022-06-15 00:59:52 +05:30
|ENV variable|Description|Default|
|--|--|--|
|PUID|The UID for psiphon process|1000|
|PGID|The GID for psiphon process|1000|
2025-06-29 03:46:52 +05:30
|HTTP_PORT|The HTTP proxy port|8080|
|SOCKS_PORT|The SOCKS proxy port|1080|
2025-09-14 02:47:41 +05:30
|DEVICE_REGION|The device region for Psiphon client|IN|
|EGRESS_REGION|The egress region for Psiphon client|SG|
2022-06-15 00:59:52 +05:30
2025-06-29 03:46:52 +05:30
# Configuration
2025-09-14 02:47:41 +05:30
The Psiphon client configuration is stored in the mounted config directory. /config must be mounted and writable by the psiphon process. <br>
2025-06-29 03:46:52 +05:30
# Healthcheck
2025-09-14 02:47:41 +05:30
The container has a healthcheck script that checks if the Psiphon client is running and healthy. <br>
2025-06-29 03:46:52 +05:30
You can check the health status of the container using the following command:
```bash
docker inspect --format='{{json .State.Health}}' psiphon
```