如何对一个 docker 实例进行 netstat ?

2022-11-09 21:56:32 +08:00
 documentzhangx66

Nextcloud 有一个 All-In-One ( AIO )的 docker 镜像。

安装方式在这里: https://github.com/nextcloud/all-in-one

但安装方式的例子,只处理了 3 个端口映射: 80 、8080 、8443

没有涉及到 https 443 端口。

而浏览器在访问 80 端口时,服务端回复让浏览器重定位到 https ,也就是 443 端口。

我怀疑官方搞错端口了,想进这个镜像进行

netstat -nlap | grep "LISTEN" | grep "443"

但进入镜像后,我发现里面啥工具都没有,如果要安装工具,需要解决一大堆包依赖问题。

请问有没有什么快捷的办法,对该镜像的实例,进行 netstat ?

1582 次点击
所在节点    Docker
11 条回复
snowish
2022-11-09 22:24:49 +08:00
你可以安装 net-tools ,
例如 Ubuntu/Debian 用这个命令安装:
apt install -y net-tools
很多镜像用 Alpine ,用下面这个命令安装:
apk install net-tools
也许你还需要用 sed 命令把源改为国内的。
leonshaw
2022-11-09 22:44:44 +08:00
nsenter
kokutou
2022-11-09 23:01:25 +08:00
看文档❎
上 v2 问✅
kiritoyui
2022-11-10 06:57:06 +08:00
@snowish 不是 apk add xxx 么?
kiritoyui
2022-11-10 07:03:44 +08:00
After the initial startup, you should be able to open the Nextcloud AIO Interface now on port 8080 of this server.
E.g. https://ip.address.of.this.server:8080

说了访问 8080 端口
Privileges
2022-11-10 09:19:24 +08:00
apk 或者 apt 装一下就好了
documentzhangx66
2022-11-10 11:52:55 +08:00
@kiritoyui

能麻烦你再看一下原题中的文字描述吗?

我怀疑官方搞错端口了,因为服务端回复让浏览器重定位到 https ,也就是 443 端口。
documentzhangx66
2022-11-10 11:53:37 +08:00
@snowish
@Privileges

麻烦各位老哥,试试你们说的 apt 装一下,就知道我为啥要专门开个帖子提问了。
Privileges
2022-11-10 13:56:35 +08:00
@documentzhangx66

你是不是进错 shell 了,docker exec -it name bash 进入后 apt 安装 net-tools 一切正常。
Privileges
2022-11-10 14:37:23 +08:00
创建并进入容器后,apt 提示未找到,我只触发过一次,但切换到 bash 后就正常了。

后面删除容器挂载缓存,重新创建容器也没再此遇到过。

证明我确实去试着装了一下 https://imgur.com/oo7Si2P
kiritoyui
2022-11-10 22:29:37 +08:00
@documentzhangx66

After the initial startup, you should be able to open the Nextcloud AIO Interface now on port 8080 of this server.
E.g. https://ip.address.of.this.server:8080

If your firewall/router has port 80 and 8443 open and you point a domain to your server, you can get a valid certificate automatically by opening the Nextcloud AIO Interface via:
https://your-domain-that-points-to-this-server.tld:8443


我不觉得我的理解有啥问题,官网文档明明让你访问 8080 ,或者 8443 ,你非要访问 80

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/893968

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX