如何在Linux服務(wù)器上安裝CVAT (Docker 28.5.1)
基于Docker 28.5.1和CVAT的穩(wěn)定版本組合,確保最佳兼容性。
推薦穩(wěn)定版本組合
| 組件 | 推薦版本 | 說明 |
|---|---|---|
| Docker | 28.5.1 | 當(dāng)前穩(wěn)定版本 |
| CVAT | 2.48.0 | 兼容Docker 28.x |
| Docker Compose | v2.40.3 | Docker 28.x內(nèi)置compose |
系統(tǒng)要求
- Ubuntu 22.04/20.04 LTS
- 至少 4GB RAM(推薦8GB+)
- 至少 20GB 可用磁盤空間
- 網(wǎng)絡(luò)連接(用于下載鏡像)
第一步:安裝Docker
1.1 卸載舊版本(可選)
sudo apt-get remove docker docker-engine docker.io containerd runc
1.2 更新系統(tǒng)并安裝依賴
sudo apt-get update sudo apt-get install ca-certificates curl
1.3 創(chuàng)建密鑰目錄并添加Docker官方GPG密鑰
sudo install -m 0755 -d /etc/apt/keyrings sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc sudo chmod a+r /etc/apt/keyrings/docker.asc
1.4 添加Docker倉庫到APT源
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null1.5 更新包列表并安裝Docker
sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
1.6 鎖定Docker版本防止自動升級(可選)
sudo apt-mark hold docker-ce docker-ce-cli containerd.io
第二步:配置Docker國內(nèi)鏡像源加速
2.1 配置Docker國內(nèi)鏡像源
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<EOF
{
"registry-mirrors": [
"https://docker.xuanyuan.me",
"https://docker.1ms.run",
"https://hub.rat.dev",
"https://docker.hpcloud.cloud",
"https://docker.m.daocloud.io",
"https://docker.tbedu.top/",
"https://docker.registry.cyou",
"https://docker-cf.registry.cyou",
"https://dockercf.jsdelivr.fyi",
"https://docker.jsdelivr.fyi",
"https://dockertest.jsdelivr.fyi",
"https://mirror.aliyuncs.com",
"https://dockerproxy.com",
"https://mirror.baidubce.com",
"https://docker.nju.edu.cn",
"https://docker.mirrors.sjtug.sjtu.edu.cn",
"https://docker.mirrors.ustc.edu.cn",
"https://mirror.iscas.ac.cn",
"https://docker.rainbond.cc"
]
}
EOF2.2 重啟Docker服務(wù)
sudo systemctl daemon-reload sudo systemctl restart docker sudo systemctl enable docker
2.3 創(chuàng)建docker用戶組并添加當(dāng)前用戶
sudo groupadd docker sudo usermod -aG docker $USER newgrp docker
2.4 驗(yàn)證Docker安裝
docker --version docker compose version
應(yīng)該顯示:
Docker version 28.5.1 Docker Compose version v2.40.3
第三步:安裝CVAT
3.1 克隆CVAT 2.48.0
cd ~ git clone -b 2.48.0 https://github.com/cvat-ai/cvat cd cvat
3.2 設(shè)置CVAT訪問地址
# 獲取本機(jī)IP地址
export CVAT_HOST=$(hostname -I | awk '{print $1}')
echo "export CVAT_HOST=$CVAT_HOST" >> ~/.bashrc
# 設(shè)置CVAT版本環(huán)境變量
echo "export CVAT_VERSION=2.48.0" >> ~/.bashrc
source ~/.bashrc
echo "CVAT將可通過 http://$CVAT_HOST:8080 訪問"第四步:啟動CVAT服務(wù)
4.1 啟動CVAT
根據(jù)自己的需求啟動方式二選一
4.1.1 啟動預(yù)構(gòu)Docker鏡像
運(yùn)行 docker 容器。下載最新的 CVAT 需要一些時間以及其他所需的映像,如 Postgres、Redis 和 Start 容器。
docker compose up -d
如果提示超時可以多運(yùn)行幾遍,
4.1.2 本地編譯構(gòu)建
docker compose -f docker-compose.yml -f docker-compose.dev.yml build
本地構(gòu)建也可能會報關(guān)于網(wǎng)絡(luò)超時的問題,多試幾次(此處耗時較多)。
關(guān)于本地構(gòu)建需要修改的幾處代碼:
在Dockerfile中添加國內(nèi)鏡像源配置(以下為修改后完整的Dockerfile文件,可直接復(fù)制)
ARG PIP_VERSION=24.2
ARG BASE_IMAGE=ubuntu:22.04
FROM ${BASE_IMAGE} AS build-image-base
# 配置pip國內(nèi)鏡像源
ENV PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple
ENV PIP_TRUSTED_HOST=pypi.tuna.tsinghua.edu.cn
ENV PIP_EXTRA_INDEX_URL=https://pypi.org/simple
ENV PIP_TIMEOUT=300
ENV PIP_RETRIES=10
# 完全重寫sources.list使用清華大學(xué)鏡像源
RUN echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse" > /etc/apt/sources.list && \
echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse" >> /etc/apt/sources.list && \
echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse" >> /etc/apt/sources.list && \
echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse" >> /etc/apt/sources.list
# 配置apt下載優(yōu)化
RUN echo 'Acquire::Retries "5";' > /etc/apt/apt.conf.d/80-retries && \
echo 'Acquire::http::Timeout "120";' >> /etc/apt/apt.conf.d/80-retries
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get --no-install-recommends install -yq \
curl \
g++ \
gcc \
git \
libgeos-dev \
libldap2-dev \
libsasl2-dev \
make \
nasm \
pkg-config \
python3-dev \
python3-pip \
libxml2-dev \
libxmlsec1-dev \
libxmlsec1-openssl \
libhdf5-dev \
cargo \
wget \
# 添加完整的FFmpeg開發(fā)包
ffmpeg \
libavcodec-dev \
libavformat-dev \
libavdevice-dev \
libavutil-dev \
libavfilter-dev \
libswscale-dev \
libswresample-dev \
libpostproc-dev \
libopenh264-dev \
libx264-dev \
&& rm -rf /var/lib/apt/lists/*
# 配置pip使用國內(nèi)源
RUN python3 -m pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple && \
python3 -m pip config set global.trusted-host pypi.tuna.tsinghua.edu.cn && \
python3 -m pip config set global.timeout 300 && \
python3 -m pip config set global.retries 10
# 配置Git使用國內(nèi)鏡像
RUN git config --global url."https://gitclone.com/github.com/".insteadOf "https://github.com/"
ARG PIP_VERSION
ENV PIP_DISABLE_PIP_VERSION_CHECK=1
RUN --mount=type=cache,target=/root/.cache/pip/http \
python3 -m pip install -U pip==${PIP_VERSION}
# We build OpenH264, FFmpeg and PyAV in a separate build stage,
# because this way Docker can do it in parallel to all the other packages.
FROM build-image-base AS build-image-av
# 確保使用國內(nèi)鏡像源
RUN python3 -m pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple && \
python3 -m pip config set global.trusted-host pypi.tuna.tsinghua.edu.cn && \
python3 -m pip config set global.timeout 300 && \
python3 -m pip config set global.retries 10
# 使用系統(tǒng)包管理器安裝視頻編解碼器
ARG PREFIX=/opt/ffmpeg
ARG PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig
ENV FFMPEG_VERSION=8.0 \
OPENH264_VERSION=2.6.0
# 安裝完整的FFmpeg開發(fā)包
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get --no-install-recommends install -yq \
ffmpeg \
libavcodec-dev \
libavformat-dev \
libavdevice-dev \
libavutil-dev \
libavfilter-dev \
libswscale-dev \
libswresample-dev \
libpostproc-dev \
libopenh264-dev \
libx264-dev \
&& rm -rf /var/lib/apt/lists/*
# 創(chuàng)建符號鏈接到指定目錄(為了兼容原有路徑)
WORKDIR /tmp/openh264
RUN echo "使用系統(tǒng)openh264庫" && \
mkdir -p ${PREFIX}/lib ${PREFIX}/include && \
# 復(fù)制openh264庫文件
cp /usr/lib/x86_64-linux-gnu/libopenh264.so* ${PREFIX}/lib/ 2>/dev/null || true && \
cp /usr/include/openh264/* ${PREFIX}/include/ 2>/dev/null || true && \
# 確保庫文件存在
(test -f ${PREFIX}/lib/libopenh264.so || ln -sf /usr/lib/x86_64-linux-gnu/libopenh264.so ${PREFIX}/lib/libopenh264.so) 2>/dev/null || true
WORKDIR /tmp/ffmpeg
RUN echo "使用系統(tǒng)ffmpeg" && \
mkdir -p ${PREFIX}/bin ${PREFIX}/lib ${PREFIX}/include && \
# 復(fù)制ffmpeg二進(jìn)制和庫文件
cp /usr/bin/ffmpeg ${PREFIX}/bin/ 2>/dev/null || true && \
cp /usr/bin/ffprobe ${PREFIX}/bin/ 2>/dev/null || true && \
cp /usr/lib/x86_64-linux-gnu/libavcodec.so* ${PREFIX}/lib/ 2>/dev/null || true && \
cp /usr/lib/x86_64-linux-gnu/libavformat.so* ${PREFIX}/lib/ 2>/dev/null || true && \
cp /usr/lib/x86_64-linux-gnu/libavdevice.so* ${PREFIX}/lib/ 2>/dev/null || true && \
cp /usr/lib/x86_64-linux-gnu/libavutil.so* ${PREFIX}/lib/ 2>/dev/null || true && \
cp /usr/lib/x86_64-linux-gnu/libavfilter.so* ${PREFIX}/lib/ 2>/dev/null || true && \
cp /usr/lib/x86_64-linux-gnu/libswscale.so* ${PREFIX}/lib/ 2>/dev/null || true && \
cp /usr/lib/x86_64-linux-gnu/libswresample.so* ${PREFIX}/lib/ 2>/dev/null || true && \
cp /usr/lib/x86_64-linux-gnu/libpostproc.so* ${PREFIX}/lib/ 2>/dev/null || true && \
# 復(fù)制頭文件
cp -r /usr/include/x86_64-linux-gnu/libav* ${PREFIX}/include/ 2>/dev/null || true && \
cp -r /usr/include/x86_64-linux-gnu/libsw* ${PREFIX}/include/ 2>/dev/null || true && \
# 創(chuàng)建pkg-config文件目錄
mkdir -p ${PREFIX}/lib/pkgconfig && \
# 復(fù)制pkg-config文件
cp /usr/lib/x86_64-linux-gnu/pkgconfig/libav*.pc ${PREFIX}/lib/pkgconfig/ 2>/dev/null || true && \
cp /usr/lib/x86_64-linux-gnu/pkgconfig/libsw*.pc ${PREFIX}/lib/pkgconfig/ 2>/dev/null || true
# 設(shè)置pkg-config路徑
ENV PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig:${PKG_CONFIG_PATH}
COPY utils/dataset_manifest/requirements.txt /tmp/utils/dataset_manifest/requirements.txt
# Since we're using pip-compile-multi, each dependency can only be listed in
# one requirements file. In the case of PyAV, that should be
# `dataset_manifest/requirements.txt`. Make sure it's actually there,
# and then remove everything else.
RUN grep -q '^av==' /tmp/utils/dataset_manifest/requirements.txt
# 修改PyAV版本為兼容系統(tǒng)FFmpeg的版本
RUN sed -i 's/^av==15.1.0/av==12.0.0/' /tmp/utils/dataset_manifest/requirements.txt
RUN sed -i '/^av==/!d' /tmp/utils/dataset_manifest/requirements.txt
RUN --mount=type=cache,target=/root/.cache/pip/http-v2 \
python3 -m pip wheel --no-binary=av \
-r /tmp/utils/dataset_manifest/requirements.txt \
-w /tmp/wheelhouse
# This stage builds wheels for all dependencies (except PyAV)
FROM build-image-base AS build-image
# 確保build-image階段也使用國內(nèi)源 - 使用阿里云鏡像
RUN python3 -m pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/ && \
python3 -m pip config set global.trusted-host mirrors.aliyun.com && \
python3 -m pip config set global.timeout 600 && \
python3 -m pip config set global.retries 15
COPY cvat/requirements/ /tmp/cvat/requirements/
COPY utils/dataset_manifest/requirements.txt /tmp/utils/dataset_manifest/requirements.txt
# Exclude av from the requirements file
RUN sed -i '/^av==/d' /tmp/utils/dataset_manifest/requirements.txt
# 更新所有文件中的numpy版本以解決依賴沖突
RUN sed -i 's/^numpy==.*/numpy==1.24.3/' /tmp/cvat/requirements/production.txt && \
sed -i 's/^numpy==.*/numpy==1.24.3/' /tmp/cvat/requirements/base.txt 2>/dev/null || true && \
sed -i 's/^numpy==.*/numpy==1.24.3/' /tmp/utils/dataset_manifest/requirements.txt
# 修正PyYAML版本沖突
RUN sed -i 's/^PyYAML==6.0.3/PyYAML==6.0.2/' /tmp/cvat/requirements/base.txt && \
sed -i 's/^PyYAML==6.0.3/PyYAML==6.0.2/' /tmp/cvat/requirements/production.txt
ARG CVAT_CONFIGURATION="production"
RUN --mount=type=cache,target=/root/.cache/pip/http-v2 \
DATUMARO_HEADLESS=1 python3 -m pip wheel --no-deps --no-binary lxml,xmlsec \
-r /tmp/cvat/requirements/${CVAT_CONFIGURATION}.txt \
-w /tmp/wheelhouse
FROM golang:1.24.4 AS build-smokescreen
# 使用國內(nèi)鏡像下載smokescreen
RUN git clone --filter=blob:none --no-checkout https://gitclone.com/github.com/stripe/smokescreen.git
RUN cd smokescreen && git checkout master && go build -o /tmp/smokescreen
FROM ${BASE_IMAGE}
ARG http_proxy
ARG https_proxy
ARG no_proxy
ARG socks_proxy
ARG TZ="Etc/UTC"
ENV TERM=xterm \
http_proxy=${http_proxy} \
https_proxy=${https_proxy} \
no_proxy=${no_proxy} \
socks_proxy=${socks_proxy} \
LANG='C.UTF-8' \
LC_ALL='C.UTF-8' \
TZ=${TZ}
# 配置pip國內(nèi)鏡像源(最終鏡像)- 添加阿里云源
ENV PIP_INDEX_URL=https://mirrors.aliyun.com/pypi/simple/
ENV PIP_TRUSTED_HOST=mirrors.aliyun.com
ENV PIP_EXTRA_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple
ENV PIP_TIMEOUT=600
ENV PIP_RETRIES=15
ARG USER="django"
ARG CVAT_CONFIGURATION="production"
ENV DJANGO_SETTINGS_MODULE="cvat.settings.${CVAT_CONFIGURATION}"
# Install necessary apt packages
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get --no-install-recommends install -yq \
bzip2 \
ca-certificates \
curl \
git \
libgeos-c1v5 \
libgl1 \
libgomp1 \
libldap-2.5-0 \
libpython3.10 \
libsasl2-2 \
libxml2 \
libxmlsec1 \
libxmlsec1-openssl \
nginx \
p7zip-full \
poppler-utils \
python3 \
python3-venv \
supervisor \
tzdata \
unrar \
wait-for-it \
# 安裝運(yùn)行時視頻編解碼器庫
ffmpeg \
libavcodec58 \
libavformat58 \
libavdevice58 \
libavutil56 \
libavfilter7 \
libswscale5 \
libswresample3 \
libpostproc55 \
&& ln -fs /usr/share/zoneinfo/${TZ} /etc/localtime && \
dpkg-reconfigure -f noninteractive tzdata && \
rm -rf /var/lib/apt/lists/* && \
echo 'application/wasm wasm' >> /etc/mime.types
# Install smokescreen
COPY --from=build-smokescreen /tmp/smokescreen /usr/local/bin/smokescreen
# Add a non-root user
ENV USER=${USER}
ENV HOME /home/${USER}
RUN adduser --uid=1000 --shell /bin/bash --disabled-password --gecos "" ${USER}
ARG CLAM_AV="no"
RUN if [ "$CLAM_AV" = "yes" ]; then \
apt-get update && \
apt-get --no-install-recommends install -yq \
clamav \
libclamunrar9 && \
sed -i 's/ReceiveTimeout 30/ReceiveTimeout 300/g' /etc/clamav/freshclam.conf && \
freshclam && \
chown -R ${USER}:${USER} /var/lib/clamav && \
rm -rf /var/lib/apt/lists/*; \
fi
# Install wheels from the build image
RUN python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:${PATH}"
# 配置虛擬環(huán)境中的pip使用國內(nèi)源
RUN /opt/venv/bin/python3 -m pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple && \
/opt/venv/bin/python3 -m pip config set global.trusted-host pypi.tuna.tsinghua.edu.cn && \
/opt/venv/bin/python3 -m pip config set global.timeout 300 && \
/opt/venv/bin/python3 -m pip config set global.retries 10
# Prevent security scanners from finding vulnerabilities in whatever version of setuptools
# is included in Ubuntu by default.
RUN python -m pip uninstall -y setuptools
ARG PIP_VERSION
ARG PIP_DISABLE_PIP_VERSION_CHECK=1
RUN python -m pip install -U pip==${PIP_VERSION}
RUN --mount=type=bind,from=build-image,source=/tmp/wheelhouse,target=/mnt/wheelhouse \
--mount=type=bind,from=build-image-av,source=/tmp/wheelhouse,target=/mnt/wheelhouse-av \
python -m pip install --no-index /mnt/wheelhouse/*.whl /mnt/wheelhouse-av/*.whl
ENV NUMPROCS=1
COPY --from=build-image-av /opt/ffmpeg/lib /usr/lib
# These variables are required for supervisord substitutions in files
# This library allows remote python debugging with VS Code
ARG CVAT_DEBUG_ENABLED
RUN if [ "${CVAT_DEBUG_ENABLED}" = 'yes' ]; then \
python3 -m pip install --no-cache-dir debugpy; \
fi
# Removing pip due to security reasons. See: https://scout.docker.com/vulnerabilities/id/CVE-2018-20225
# The vulnerability is dubious and we don't use pip at runtime, but some vulnerability scanners mark it as a high vulnerability,
# and it was decided to remove pip from the final image
RUN python -m pip uninstall -y pip
# Install and initialize CVAT, copy all necessary files
COPY cvat/nginx.conf /etc/nginx/nginx.conf
COPY --chown=${USER} supervisord/ ${HOME}/supervisord
COPY --chown=${USER} backend_entrypoint.d/ ${HOME}/backend_entrypoint.d
COPY --chown=${USER} manage.py rqscheduler.py backend_entrypoint.sh wait_for_deps.sh ${HOME}/
COPY --chown=${USER} utils/ ${HOME}/utils
COPY --chown=${USER} cvat/ ${HOME}/cvat
COPY --chown=${USER} components/analytics/clickhouse/init.py ${HOME}/components/analytics/clickhouse/init.py
ARG COVERAGE_PROCESS_START
RUN if [ "${COVERAGE_PROCESS_START}" ]; then \
echo "import coverage; coverage.process_startup()" > /opt/venv/lib/python3.10/site-packages/coverage_subprocess.pth; \
fi
# RUN all commands below as 'django' user.
# Use numeric UID/GID so that the image is compatible with the Kubernetes runAsNonRoot setting.
USER 1000:1000
WORKDIR ${HOME}
RUN mkdir -p data share keys logs /tmp/supervisord static
EXPOSE 8080
ENTRYPOINT ["./backend_entrypoint.sh"]修改./cvat/requirements/base.txt
# 完全移除版本限制,讓pip選擇兼容版本 sed -i 's/==/>=/g' cvat/requirements/base.txt
清理緩存
# 如果遇到損壞的包或者不匹配的包需要清理緩存,重新構(gòu)建
docker builder prune -f
# 也可以使用docker build直接構(gòu)建特定階段
docker build \
--target build-image \
--no-cache \
-t cvat_server_build_image \
-f Dockerfile .
# 然后繼續(xù)使用compose構(gòu)建
docker compose -f docker-compose.yml -f docker-compose.dev.yml build cvat_server4.2 監(jiān)控啟動過程
# 實(shí)時查看啟動日志(可選) docker compose logs -f & # 等待服務(wù)完全啟動(重要?。? echo "等待CVAT服務(wù)啟動,這可能需要3-5分鐘..." sleep 180
4.3 檢查所有服務(wù)狀態(tài)
docker compose ps
預(yù)期正常狀態(tài):
NAME SERVICE STATUS PORTS cvat_db cvat_db Running cvat_redis cvat_redis Running cvat_server cvat_server Running 8080/tcp cvat_ui cvat_ui Running 80/tcp ... 所有服務(wù)都是Running狀態(tài)
4.4 如果服務(wù)異常的處理
# 如果服務(wù)沒有正常啟動,執(zhí)行清理重啟 docker compose down docker system prune -f docker volume prune -f # 重新啟動 docker compose up -d sleep 180 docker compose ps
第五步:創(chuàng)建管理員賬戶
5.1 等待數(shù)據(jù)庫完全就緒
# 檢查數(shù)據(jù)庫狀態(tài) until docker logs cvat_db 2>&1 | grep -q "database system is ready to accept connections"; do echo "等待數(shù)據(jù)庫啟動..." sleep 10 done echo "數(shù)據(jù)庫已就緒"
5.2 創(chuàng)建超級用戶
# 方法1:直接創(chuàng)建 docker exec -it cvat_server bash -ic 'python3 ~/manage.py createsuperuser' # 方法2:如果方法1失敗,先進(jìn)入容器再創(chuàng)建 docker exec -it cvat_server bash # 在容器內(nèi)執(zhí)行: python3 ~/manage.py createsuperuser # 創(chuàng)建完成后輸入 exit 退出容器
按照提示輸入管理員信息:
用戶名: admin 電子郵件: admin@example.com 密碼: ******** (建議使用強(qiáng)密碼) 密碼確認(rèn): ******** Superuser created successfully.
第六步:驗(yàn)證安裝和訪問
6.1 最終狀態(tài)檢查
# 檢查所有服務(wù)狀態(tài) docker compose ps # 檢查CVAT服務(wù)日志 docker logs cvat_server | tail -10 # 獲取最終訪問信息 echo "===========================================" echo "CVAT安裝完成!" echo "訪問地址: http://$CVAT_HOST:8080" echo "管理員用戶名: admin" echo "使用您設(shè)置的密碼登錄" echo "==========================================="
6.2 瀏覽器訪問測試
在瀏覽器中訪問 http://您的服務(wù)器IP:8080:
- 使用
admin和您設(shè)置的密碼登錄 - 確認(rèn)可以正常進(jìn)入CVAT界面
- 嘗試創(chuàng)建一個測試任務(wù)驗(yàn)證功能正常
訪問方式詳解
7.1 局域網(wǎng)內(nèi)直接訪問
http://服務(wù)器IP:8080
示例:如果服務(wù)器IP是 192.168.1.100,則訪問 http://192.168.1.100:8080
7.2 外部網(wǎng)絡(luò)訪問(SSH隧道)
# 在您的筆記本電腦上執(zhí)行 ssh -L 8080:localhost:8080 用戶名@服務(wù)器IP -N # 后臺運(yùn)行版本 ssh -L 8080:localhost:8080 用戶名@服務(wù)器IP -N -f # 然后瀏覽器訪問 # http://localhost:8080
7.3 瀏覽器要求
- ? Google Chrome (90+,推薦)
- ? Microsoft Edge (90+)
- ? Brave (基于Chromium)
- ?? Firefox (可能部分功能不兼容)
- ? Safari (不推薦)
維護(hù)和管理命令
8.1 日常管理
# 停止CVAT服務(wù) cd ~/cvat && docker compose down # 啟動CVAT服務(wù) cd ~/cvat && docker compose up -d # 查看服務(wù)狀態(tài) cd ~/cvat && docker compose ps # 查看服務(wù)日志 cd ~/cvat && docker compose logs
8.2 數(shù)據(jù)備份
# 備份數(shù)據(jù)庫 docker exec cvat_db pg_dump -U root cvat > cvat_backup_$(date +%Y%m%d).sql # 備份上傳的文件 tar -czf cvat_data_backup_$(date +%Y%m%d).tar.gz ~/cvat/data
8.3 問題診斷
# 查看詳細(xì)服務(wù)狀態(tài) docker compose ps -a # 查看特定服務(wù)日志 docker compose logs cvat_server docker compose logs cvat_db # 檢查資源使用 docker system df docker stats
故障排除指南
9.1 端口沖突
# 檢查端口占用 sudo netstat -tulpn | grep 8080 # 修改CVAT端口 # 編輯 docker-compose.override.yml 修改端口映射
9.2 磁盤空間不足
# 清理Docker資源 docker system prune -a -f docker volume prune -f # 檢查空間使用 df -h docker system df
9.3 服務(wù)啟動失敗
# 查看詳細(xì)錯誤 docker compose logs cvat_server docker compose logs cvat_db # 完全重置 cd ~/cvat docker compose down -v docker system prune -a -f CVAT_VERSION=2.12.0 docker compose up -d
重要提醒
- 不要隨意升級:避免單獨(dú)升級某個組件導(dǎo)致兼容性問題
- 定期備份:重要標(biāo)注數(shù)據(jù)定期備份到安全位置
- 監(jiān)控資源:關(guān)注磁盤空間,CVAT運(yùn)行會占用較多資源
- 安全考慮:生產(chǎn)環(huán)境建議配置防火墻和HTTPS
到此這篇關(guān)于在Linux服務(wù)器上安裝CVAT (Docker 28.5.1)的文章就介紹到這了,更多相關(guān)Linux服務(wù)器安裝CVAT內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
詳解把Node.js項(xiàng)目部署到阿里云服務(wù)器(CentOs)
本篇文章主要介紹了把Node.js項(xiàng)目部署到阿里云服務(wù)器,非常具有實(shí)用價值,需要的朋友可以參考下2017-04-04
Linux關(guān)機(jī)時執(zhí)行指定腳本功能實(shí)現(xiàn)
本篇文章給大家分享了Linux關(guān)機(jī)時執(zhí)行指定腳本功能的實(shí)現(xiàn)詳解,對此有需要的朋友跟著小編一起學(xué)習(xí)下。2018-03-03

