cvat启动成功之后无法访问

Posted 修炼之路

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了cvat启动成功之后无法访问相关的知识,希望对你有一定的参考价值。

错误信息

cvat安装好之后,通过docker-compose up -d启动成功之后,输出信息如下

$ docker-compose up -d
/root/anaconda3/lib/python3.5/site-packages/paramiko/transport.py:33: CryptographyDeprecationWarning: Python 3.5 support will be dropped in the next release of cryptography. Please upgrade your Python.
  from cryptography.hazmat.backends import default_backend
Creating network "cvat_default" with the default driver
Creating cvat_redis ... done
Creating cvat_db    ... done
Creating cvat       ... done
Creating cvat_ui    ... done
Creating cvat_proxy ... done

通过localhost:8080来访问时,提示无法访问。通过下面命令来创建super user时报错

#创建super user
docker exec -it cvat bash -ic 'python3 ~/manage.py createsuperuser'
#错误信息如下
django.db.utils.OperationalError: could not connect to server: Connection timed out
	Is the server running on host "cvat_db" (172.28.0.3) and accepting
	TCP/IP connections on port 5432?

解决办法

方法1

  • ifconfig命令查看docker占用的网络服务
$ ifconfig
br-fe794652b2b6 Link encap:Ethernet  HWaddr 02:42:07:cf:35:d7  
          inet addr:172.28.0.1  Bcast:172.28.0.255  Mask:255.255.255.0
          inet6 addr: fe80::42:7ff:fecf:35d7/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:183 errors:0 dropped:0 overruns:0 frame:0
          TX packets:249 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:236909 (236.9 KB)  TX bytes:35323 (35.3 KB)

如果在docker-compose down之后这个服务还在,我们就通过sudo ifconfig br-fe794652b2b6 down来关闭这个服务之后,再通过docker-compose up重启之后这个问题就能解决了

方法2

通过上面的信息不难看出,应该是cvat_db无法连接导致的,我们通过docker来测试连接,发现根本无法ping通

> docker exec -it cvat_db bash
bash-5.1# ping 172.28.0.4
PING 172.28.0.4 (172.28.0.4): 56 data bytes
^C
--- 172.28.0.4 ping statistics ---
5 packets transmitted, 0 packets received, 100% packet loss
bash-5.1# ping 172.28.0.0
PING 172.28.0.0 (172.28.0.0): 56 data bytes
^C
--- 172.28.0.0 ping statistics ---
5 packets transmitted, 0 packets received, 100% packet loss
bash-5.1# ping 172.28.0.6
PING 172.28.0.6 (172.28.0.6): 56 data bytes
^C
--- 172.28.0.6 ping statistics ---
2 packets transmitted, 0 packets received, 100% packet loss

修改配置文件中设置的IP地址,修改内容如下

将172.28.0.0/24改为
172.18.0.0/16
将172.28.0.1改为
172.18.0.0

修改完成之后,重新启动即可访问

参考:

  1. https://openvinotoolkit.github.io/cvat/docs/for-users/installation/
  2. https://github.com/openvinotoolkit/cvat/issues/3179

以上是关于cvat启动成功之后无法访问的主要内容,如果未能解决你的问题,请参考以下文章

vue项目启动之后外网无法访问

vue2启动成功了,但是无法访问

Linux 部署项目并启动后,外网无法访问的几个原因

善待自己

从片段内部访问 Toolbar/ActionBar 对象

docker容器显示graylog启动成功但无法访问