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

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

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

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

    11 replies    2024-10-21 14:11:44 +08:00
    liuweiqing
        1
    liuweiqing  
    OP
       Oct 18, 2024
    还有就是关闭容器会导致电脑重启
    PbCopy111
        2
    PbCopy111  
       Oct 18, 2024
    没听懂,你说的容器是啥?是 docker 么?你是怎么安装的?安装的那个??
    liuweiqing
        3
    liuweiqing  
    OP
       Oct 18, 2024
    Kinnice
        4
    Kinnice  
       Oct 18, 2024   ❤️ 1
    你是怎么启动的,启动命令是什么
    liuweiqing
        5
    liuweiqing  
    OP
       Oct 18, 2024
    @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
        6
    Kinnice  
       Oct 19, 2024 via Android
    你的宿主机是什么?看起来也没把 tty 挂进去呀
    liuweiqing
        7
    liuweiqing  
    OP
       Oct 19, 2024
    @Kinnice 使用 privileged 导致的,不能用这个
    julyclyde
        8
    julyclyde  
       Oct 20, 2024
    不明白为什么要在容器里运行路由软件
    容器连内核都没有,咋转发网络数据呢?
    liuweiqing
        9
    liuweiqing  
    OP
       Oct 21, 2024
    @julyclyde 我的 openwrt 容器运行的好好的
    julyclyde
        10
    julyclyde  
       Oct 21, 2024
    @liuweiqing 是不是强依赖 privilege ?设置的 MASQUERADE 规则是在 host 上的?
    liuweiqing
        11
    liuweiqing  
    OP
       Oct 21, 2024
    @julyclyde 不需要 privilege ,第二个问题我不清楚
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4151 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 10:11 · PVG 18:11 · LAX 03:11 · JFK 06:11
    ♥ Do have faith in what you're doing.