美文网首页
alpine docker安装openvpn遇到的问题

alpine docker安装openvpn遇到的问题

作者: 一剑仙人跪_ | 来源:发表于2021-10-11 10:57 被阅读0次

配置国内源


# 配置国内源
echo "http://mirrors.aliyun.com/alpine/latest-stable/main/" > /etc/apk/repositories
echo "http://mirrors.aliyun.com/alpine/latest-stable/community/" >> /etc/apk/repositories
 
# 升级apk-tools
apk upgrade --no-cache apk-tools

安装 rc-service 服务

Alpine使用的是OpenRCinit系统,而rc-service是openrc的一部分,所以安装openrc即可,使用如下命令安装:

apk add openrc --no-cache
管理服务
列出所有可用服务
rc-service --list

启动/停止/重启 已有服务
rc-service 服务名 start/stop/restart
OR
/etc/init.d/服务名 start/stop/restart

设置开机自启动
rc-update add {service-name}

启动openvpn报错

  1. 出现:* WARNING: openvpn is already starting或touch: /run/openrc/softlevel: No such file or directory问题
    解决方案
sudo apk add --no-cache openrc
sudo openrc
sudo touch /run/openrc/softlevel
sudo rc-service openvpn start
  1. 出现 Note: Cannot open TUN/TAP dev /dev/net/tun: Permission denied (errno=13) Note: Attempting fallback to kernel 2.2 TUN/TAP interface Cannot open TUN/TAP dev /dev/tun0: No such file or directory (errno=2)
    The TUN/TAP device is not set up by default on your VPS. Instructions will vary with your virtualization platform.

解决:

 mkdir -p /dev/net
 mknod /dev/net/tun c 10 200
 chmod 600 /dev/net/tun
 cat /dev/net/tun测试TUN/TAP设备是否可用:
如果您收到消息cat: /dev/net/tun: File descriptor in bad state您的 TUN/TAP 设备已准备好使用
如果您收到消息cat: /dev/net/tun: No such device the TUN/TAP 设备未成功创建```

另一种解决办法:http://blog.huati365.com/de40b3efbb095ce8

  1. 老是提示
/lib/rc/sh/openrc-run.sh: line 279: can’t create /sys/fs/cgroup/blkio/tasks: Read-only file system
/lib/rc/sh/openrc-run.sh: line 279: can’t create /sys/fs/cgroup/cpu/tasks: Read-only file system
/lib/rc/sh/openrc-run.sh: line 279: can’t create /sys/fs/cgroup/cpu,cpuacct/tasks: Read-only file system
/lib/rc/sh/openrc-run.sh: line 279: can’t create /sys/fs/cgroup/cpuacct/tasks: Read-only file system
/lib/rc/sh/openrc-run.sh: line 279: can’t create /sys/fs/cgroup/cpuset/tasks: Read-only file system
/lib/rc/sh/openrc-run.sh: line 279: can’t create /sys/fs/cgroup/devices/tasks: Read-only file system
/lib/rc/sh/openrc-run.sh: line 279: can’t create /sys/fs/cgroup/freezer/tasks: Read-only file system
/lib/rc/sh/openrc-run.sh: line 279: can’t create /sys/fs/cgroup/hugetlb/tasks: Read-only file system
/lib/rc/sh/openrc-run.sh: line 279: can’t create /sys/fs/cgroup/memory/tasks: Read-only file system
/lib/rc/sh/openrc-run.sh: line 279: can’t create /sys/fs/cgroup/net_cls/tasks: Read-only file system
/lib/rc/sh/openrc-run.sh: line 279: can’t create /sys/fs/cgroup/net_cls,net_prio/tasks: Read-only file system
/lib/rc/sh/openrc-run.sh: line 279: can’t create /sys/fs/cgroup/net_prio/tasks: Read-only file system
/lib/rc/sh/openrc-run.sh: line 279: can’t create /sys/fs/cgroup/perf_event/tasks: Read-only file system
/lib/rc/sh/openrc-run.sh: line 279: can’t create /sys/fs/cgroup/pids/tasks: Read-only file system
/lib/rc/sh/openrc-run.sh: line 279: can’t create /sys/fs/cgroup/systemd/tasks: Read-only file system

解决
dockerfile加了一条:VOLUME [ “/sys/fs/cgroup” ]

相关文章

网友评论

      本文标题:alpine docker安装openvpn遇到的问题

      本文链接:https://www.haomeiwen.com/subject/desdoltx.html