101 lines
2.9 KiB
Markdown
101 lines
2.9 KiB
Markdown
# Install CVAT in a Ubuntu Docker Container
|
|
|
|
|
|
This is a little tutorial to install CVAT in a docker container.
|
|
|
|
NOT fully tested❗❗❗
|
|
|
|
### Step 1: Create a Dockerfile
|
|
|
|
This Dockerfile will install Docker, Docker Compose, CVAT, and Google Chrome on an Ubuntu 22.04 base image.
|
|
|
|
```Dockerfile
|
|
# Use the official Ubuntu 22.04 image as a base
|
|
FROM ubuntu:22.04
|
|
|
|
# Set environment variables
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
# Update and install necessary packages
|
|
RUN apt-get update && \
|
|
apt-get --no-install-recommends install -y \
|
|
apt-transport-https \
|
|
ca-certificates \
|
|
curl \
|
|
gnupg-agent \
|
|
software-properties-common \
|
|
git \
|
|
sudo \
|
|
wget \
|
|
python3-pip \
|
|
python3-dev
|
|
|
|
# Install Docker
|
|
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - && \
|
|
add-apt-repository \
|
|
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
|
|
$(lsb_release -cs) \
|
|
stable" && \
|
|
apt-get update && \
|
|
apt-get --no-install-recommends install -y \
|
|
docker-ce docker-ce-cli containerd.io docker-compose-plugin
|
|
|
|
# Install Google Chrome
|
|
RUN curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
|
|
sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list' && \
|
|
apt-get update && \
|
|
apt-get --no-install-recommends install -y google-chrome-stable
|
|
|
|
# Clone CVAT repository
|
|
RUN git clone https://github.com/cvat-ai/cvat /cvat
|
|
|
|
# Set working directory
|
|
WORKDIR /cvat
|
|
|
|
# Set default environment variables
|
|
ENV CVAT_HOST=localhost
|
|
ENV CVAT_VERSION=dev
|
|
|
|
# Expose the necessary ports
|
|
EXPOSE 8080
|
|
|
|
# Start CVAT
|
|
CMD ["bash", "-c", "export CVAT_HOST=$CVAT_HOST && docker-compose up -d && sleep infinity"]
|
|
```
|
|
|
|
### Step 2: Build the Docker Image
|
|
|
|
Build the Docker image using the Dockerfile.
|
|
|
|
```bash
|
|
docker build -t cvat-ubuntu-22.04 .
|
|
```
|
|
|
|
### Step 3: Run the Docker Container
|
|
|
|
Run the Docker container with adjustable environment variables.
|
|
|
|
```bash
|
|
docker run -d --name cvat-container -p 8080:8080 \
|
|
-e CVAT_HOST="your_host_or_ip" \
|
|
-e CVAT_VERSION="your_version" \
|
|
cvat-ubuntu-22.04
|
|
```
|
|
|
|
### Step 4: Create a Superuser
|
|
|
|
After the container is running, create a superuser for CVAT.
|
|
|
|
```bash
|
|
docker exec -it cvat-container bash -c 'docker-compose exec cvat_server bash -ic "python3 ~/manage.py createsuperuser"'
|
|
```
|
|
|
|
### Step 5: Access CVAT
|
|
|
|
Open Google Chrome and navigate to `http://localhost:8080` to access CVAT. Log in with the superuser credentials you created.
|
|
|
|
### Notes
|
|
|
|
1. **Adjustable Parameters**: The `CVAT_HOST` and `CVAT_VERSION` environment variables can be set when running the Docker container to adjust the host and CVAT version.
|
|
2. **Permissions**: Ensure that the Docker daemon has the necessary permissions. You might need to run the Docker commands with `sudo` or adjust the Docker group settings as described in the tutorial.
|