我试图通过将其添加到 docker-compose 文件来在特定 IP 上启动 docker 容器:
- ports
- 'xxx.xxx.253.202:443:443'
我明白了:
来自守护进程的错误响应:驱动程序在端点 api_server 上编程外部连接失败(7b45d6741b8eeaecae2ff4ed1da217531f79d852a596b8f7a08cd6ee55a8ab9d):启动用户态代理时出错:监听 tcp4 xxx.xxx.253.202:443:绑定:地址已在使用中
但当我查看连接时:
> ss -atp
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 4096 0.0.0.0:postgresql 0.0.0.0:* users:(("docker-proxy",pid=1937,fd=4))
LISTEN 0 4096 0.0.0.0:https 0.0.0.0:* users:(("docker-proxy",pid=1377,fd=4))
LISTEN 0 4096 0.0.0.0:9090 0.0.0.0:* users:(("docker-proxy",pid=1378,fd=4))
LISTEN 0 4096 0.0.0.0:5000 0.0.0.0:* users:(("docker-proxy",pid=1443,fd=4))
LISTEN 0 4096 0.0.0.0:redis 0.0.0.0:* users:(("docker-proxy",pid=813646,fd=4))
LISTEN 0 4096 xxx.xxx.253.201:http 0.0.0.0:* users:(("docker-proxy",pid=661622,fd=4))
LISTEN 0 4096 xxx.xxx.253.201:ftp 0.0.0.0:* users:(("docker-proxy",pid=661635,fd=4))
LISTEN 0 128 0.0.0.0:ssh 0.0.0.0:* users:(("sshd",pid=1046,fd=3))
ESTAB 0 0 xxx.xxx.102.49:ssh 80.71.49.109:56098 users:(("sshd",pid=802944,fd=4))
ESTAB 0 152 xxx.xxx.102.49:ssh 80.71.49.109:62244 users:(("sshd",pid=809288,fd=4))
CLOSE-WAIT 0 0 172.18.0.1:42636 172.18.0.8:postgresql users:(("docker-proxy",pid=1937,fd=14))
FIN-WAIT-2 0 0 127.0.0.1:postgresql 127.0.0.1:59520 users:(("docker-proxy",pid=1937,fd=13))
CLOSE-WAIT 0 0 127.0.0.1:59520 127.0.0.1:postgresql users:(("sshd",pid=802944,fd=10))
CLOSE-WAIT 0 0 172.18.0.1:48950 172.18.0.8:postgresql users:(("docker-proxy",pid=1937,fd=22))
FIN-WAIT-2 0 0 127.0.0.1:postgresql 127.0.0.1:56550 users:(("docker-proxy",pid=1937,fd=21))
CLOSE-WAIT 0 0 127.0.0.1:56550 127.0.0.1:postgresql users:(("sshd",pid=802944,fd=11))
ESTAB 0 0 xxx.xxx.102.49:ssh 80.71.49.109:64028 users:(("sshd",pid=819293,fd=4))
LISTEN 0 4096 [::]:postgresql [::]:* users:(("docker-proxy",pid=1960,fd=4))
LISTEN 0 4096 [::]:https [::]:* users:(("docker-proxy",pid=1392,fd=4))
LISTEN 0 4096 [::]:9090 [::]:* users:(("docker-proxy",pid=1391,fd=4))
LISTEN 0 4096 [::]:5000 [::]:* users:(("docker-proxy",pid=1450,fd=4))
LISTEN 0 4096 [::]:redis [::]:* users:(("docker-proxy",pid=813653,fd=4))
LISTEN 0 128 [::]:ssh [::]:* users:(("sshd",pid=1046,fd=4))
我没有看到任何使用 .202 地址的内容。
网络地址如下:
> ip address show
eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether xx:xx:xx:2f:37:51 brd ff:ff:ff:ff:ff:ff
altname enp0s31f6
inet xxx.xxx.102.49/26 brd xxx.xxx.102.63 scope global eno1
valid_lft forever preferred_lft forever
inet xxx.xxx.253.201/29 brd xxx.xxx.253.207 scope global eno1:1
valid_lft forever preferred_lft forever
inet xxx.xxx.253.202/29 brd xxx.xxx.253.207 scope global secondary eno1:2
valid_lft forever preferred_lft forever
inet xxx.xxx.253.203/29 brd xxx.xxx.253.207 scope global secondary eno1:3
valid_lft forever preferred_lft forever
inet xxx.xxx.253.204/29 brd xxx.xxx.253.207 scope global secondary eno1:4
valid_lft forever preferred_lft forever
inet xxx.xxx.253.205/29 brd xxx.xxx.253.207 scope global secondary eno1:5
valid_lft forever preferred_lft forever
inet xxx.xxx.253.206/29 brd xxx.xxx.253.207 scope global secondary eno1:6
valid_lft forever preferred_lft forever
inet6 fe80::52eb:f6ff:fe2f:3751/64 scope link
valid_lft forever preferred_lft forever
我该如何解决这个问题?
答案1
这是监听端口 443 的行:
LISTEN 0 4096 0.0.0.0:https 0.0.0.0:*
下次添加n
到命令行来查看数字,而不是解析的协议。
ss -antp
PS0.0.0.0
表示机器上的任何IP。