OpenWrt 是一个专门面向嵌入式设备的 Linux 发行版。你可以将 OpenWrt 支持的型号的嵌入式设备,比如各种路由器上的系统,换成一个有更多可能性可以折腾的 Linux 系统。
› OpenWrt 官方网站
liuweiqing
V2EX  ›  OpenWrt

为什么用了 openwrt 的容器之后,服务器打开进入的是 openwrt 命令行,无法退出?

  •  
  •   liuweiqing · Oct 18, 2024 · 7231 views
    This topic created in 745 days ago, the information mentioned may be changed or developed.

    ssh 还是正常的,桌面也可以进入,但是退出后就进入 openwrt 命令行

    11 replies  •  2024-10-21 14:11:44 +08:00
    liuweiqing
    liuweiqing
    OP
    Oct 18, 2024
    1
    还有就是关闭容器会导致电脑重启
    PbCopy111
    PbCopy111
    Oct 18, 2024
    2
    没听懂,你说的容器是啥?是 docker 么?你是怎么安装的?安装的那个??
    liuweiqing
    liuweiqing
    OP
    Oct 18, 2024
    3
    Kinnice
    Kinnice
    Oct 18, 2024❤️1
    4
    你是怎么启动的,启动命令是什么
    liuweiqing
    liuweiqing
    OP
    Oct 18, 2024
    5
    @Kinnice
    ```sh
    services:
    openwrt:
    image: 14790897/openwrt:x86_64
    container_name: openwrt
    restart: always
    privileged: true
    networks:
    macvlan_net:
    command: /sbin/init

    networks:
    macvlan_net:
    driver: macvlan
    driver_opts:
    parent: enp1s0 # 更换为自己的网口
    ipam:
    config:
    - subnet: 192.168.0.0/24 # 更换为自己的子网
    gateway: 192.168.0.1 # 更换为自己的的网关
    ```
    Kinnice
    Kinnice
    Oct 19, 2024 via Android
    6
    你的宿主机是什么?看起来也没把 tty 挂进去呀
    liuweiqing
    liuweiqing
    OP
    Oct 19, 2024
    7
    @Kinnice 使用 privileged 导致的,不能用这个
    julyclyde
    julyclyde
    Oct 20, 2024
    8
    不明白为什么要在容器里运行路由软件
    容器连内核都没有,咋转发网络数据呢?
    liuweiqing
    liuweiqing
    OP
    Oct 21, 2024
    9
    @julyclyde 我的 openwrt 容器运行的好好的
    julyclyde
    julyclyde
    Oct 21, 2024
    10
    @liuweiqing 是不是强依赖 privilege ?设置的 MASQUERADE 规则是在 host 上的?
    liuweiqing
    liuweiqing
    OP
    Oct 21, 2024
    11
    @julyclyde 不需要 privilege ,第二个问题我不清楚
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   5188 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 56ms · UTC 03:26 · PVG 11:26 · LAX 19:26 · JFK 22:26
    ♥ Do have faith in what you're doing.