From e80b7f3f3e1391fb0630408626963485cb2aebb5 Mon Sep 17 00:00:00 2001 From: Cao Mingjun Date: Wed, 18 Dec 2024 15:09:21 +0800 Subject: [PATCH] Revert "pass the TUN device instead of creating it in the container, fix #41." This reverts commit 06239fcb48c58aff3db4bcaf621f7420afd77f16. --- README.md | 2 -- docker-compose.yml | 2 -- docs/proxy-mode.md | 2 -- docs/warp-connector.md | 2 -- entrypoint.sh | 14 ++++---------- 5 files changed, 4 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 76a639d..255afe5 100644 --- a/README.md +++ b/README.md @@ -23,8 +23,6 @@ services: image: caomingjun/warp container_name: warp restart: always - devices: - - /dev/net/tun:/dev/net/tun ports: - "1080:1080" environment: diff --git a/docker-compose.yml b/docker-compose.yml index af6f518..8b111f7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,8 +5,6 @@ services: image: caomingjun/warp container_name: warp restart: always - devices: - - /dev/net/tun:/dev/net/tun ports: - "1080:1080" environment: diff --git a/docs/proxy-mode.md b/docs/proxy-mode.md index 8809d5f..3e8ea28 100644 --- a/docs/proxy-mode.md +++ b/docs/proxy-mode.md @@ -36,8 +36,6 @@ services: image: caomingjun/warp container_name: warp restart: always - devices: - - /dev/net/tun:/dev/net/tun ports: - "1080:1080" environment: diff --git a/docs/warp-connector.md b/docs/warp-connector.md index 9c457fe..8bc11cd 100644 --- a/docs/warp-connector.md +++ b/docs/warp-connector.md @@ -17,8 +17,6 @@ services: image: caomingjun/warp container_name: warp restart: always - devices: - - /dev/net/tun:/dev/net/tun ports: - "1080:1080" environment: diff --git a/entrypoint.sh b/entrypoint.sh index f86f61c..7796d85 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -3,17 +3,11 @@ # exit when any command fails set -e -# check if /dev/net/tun is available +# create a tun device if not exist to ensure compatibility with Podman if [ ! -e /dev/net/tun ]; then - if [ -n "$LEGACY_TUN_SUPPORT" ]; then - echo "WARN: LEGACY_TUN_SUPPORT enabled, creating /dev/net/tun..." - sudo mkdir -p /dev/net - sudo mknod /dev/net/tun c 10 200 - sudo chmod 600 /dev/net/tun - else - echo "CRITIC: /dev/net/tun not pass, check https://github.com/cmj2002/warp-docker/blob/main/docs/tun-not-permitted.md for more information" - exit 1 - fi + sudo mkdir -p /dev/net + sudo mknod /dev/net/tun c 10 200 + sudo chmod 600 /dev/net/tun fi # start dbus