(solved) django.db.utils.OperationalError: could not translate host name “cvat_db” to address: Temporary failure in name resolution
如題,我嘗試在win10安裝CVAT,但按照官方範例卻會出錯,錯誤訊息是執行super user建立過程會出現來自cvat_db的錯誤,並後續沒辦法打開CVAT的網頁。(default: http://localhost:8080/)
sudo docker exec -it cvat_server bash -ic ‘python3 ~/manage.py createsuperuser’
錯誤訊息如下
django.db.utils.OperationalError: could not translate host name “cvat_db” to address: Temporary failure in name resolution
官方github有一個issue是關於這件事(#1152),但我發現他們的解決方法已經被內建在最新版本的CVAT docker_compose.yml上了,而我依然遇到這個問題。
我的解決方案是安裝舊版本的CVAT,但方法不是用文件上描述的CVAT_VERSION=dev docker compose up -d,而是直接clone舊版本的CVAT repo,使用以下程式碼
git clone -b v2.1.0 https://github.com/opencv/cvat
cd cvat
後續就跟官方流程相同,非常順利。
完整流程如下
這裡先盤點pre-requirements,這是官方指定的需求。
- Install WSL2 (Windows subsystem for Linux)
- Download and install Docker Desktop for Windows.
- Download and install Git for Windows.
- Download and install Google Chrome.
Install CVAT
接下來就是安裝CVAT的流程
- 先git clone repo,主要是靠這一步解決錯誤。
git clone -b v2.1.0 https://github.com/opencv/cvat
cd cvat
2. 安裝docker container
docker compose up -d
3. 設定super user
sudo docker exec -it cvat_server bash -ic 'python3 ~/manage.py createsuperuser'
4. 接下來打開http://localhost:8080/網頁,應該就能看到CVAT的介面了。