|
2 | 2 |
|
3 | 3 | This guide will help you set up and run Cortex using Docker. |
4 | 4 |
|
| 5 | +For more information on how to use Cortex, please refer to the [Cortex Documentation](https://cortex.so/docs/) and [Cortex Docker](https://cortex.so/docs/installation/docker). |
| 6 | + |
5 | 7 | ### Prerequisites |
6 | 8 | - Docker / Docker Desktop |
7 | 9 | - nvidia-container-toolkit (for GPU support) |
8 | 10 |
|
9 | 11 | ### Instructions |
10 | | -1. Clone the Cortex repository |
11 | | - ```bash |
12 | | - git clone https://github.com/janhq/cortex.cpp.git |
13 | | - cd cortex.cpp |
14 | | - git submodule update --init |
15 | | - ``` |
16 | | -2. Build the Docker image |
17 | | - ```bash |
18 | | - # Default always uses the latest cortex.cpp and cortex.llamacpp |
19 | | - docker build -t cortex --build-arg CORTEX_CPP_VERSION=$(git rev-parse HEAD) -f docker/Dockerfile . |
20 | | -
|
21 | | - # Use specific version of cortex.cpp and cortex.llamacpp |
22 | | - docker build --build-arg CORTEX_LLAMACPP_VERSION=0.1.34 --build-arg CORTEX_CPP_VERSION=$(git rev-parse HEAD) -t cortex -f docker/Dockerfile . |
23 | | - ``` |
24 | | - |
25 | | -3. Run the Docker container |
26 | | - ```bash |
27 | | - # Create Volume to store models and data |
28 | | - docker volume create cortex_data |
29 | | -
|
30 | | - # CPU mode |
31 | | - docker run -it -d --name cortex -v cortex_data:/root/cortexcpp -p 39281:39281 cortex |
32 | | -
|
33 | | - # GPU mode - nvidia-docker required, it will automatically use all available GPUs |
34 | | - docker run --gpus all -it -d --name cortex -v cortex_data:/root/cortexcpp -p 39281:39281 cortex |
35 | | - ``` |
36 | | - |
37 | | -4. Check logs (Optional) |
38 | | - ```bash |
39 | | - docker logs cortex |
40 | | - ``` |
41 | | - |
42 | | -5. Access to http://localhost:39281 to check the cortex docs API. |
43 | | - |
44 | | -6. Execute to container and try out cortex cli |
45 | | - ```bash |
46 | | - docker exec -it cortex bash |
47 | | - cortex --help |
48 | | - ``` |
| 12 | + |
| 13 | +**Build Cortex Docker Image from source or Pull from Docker Hub** |
| 14 | + |
| 15 | +- Pull Cortex Docker Image from Docker Hub |
| 16 | + |
| 17 | +```bash |
| 18 | +# Pull the latest image |
| 19 | +docker pull menloltd/cortex:latest |
| 20 | + |
| 21 | +# Pull a specific version |
| 22 | +docker pull menloltd/cortex:nightly-1.0.1-224 |
| 23 | +``` |
| 24 | + |
| 25 | +- Build and Run Cortex Docker Container from Dockerfile |
| 26 | + |
| 27 | +```bash |
| 28 | +git clone https://github.com/janhq/cortex.cpp.git |
| 29 | +cd cortex.cpp |
| 30 | +git submodule update --init |
| 31 | + |
| 32 | +# Default always uses the latest cortex.cpp and cortex.llamacpp |
| 33 | +docker build -t menloltd/cortex --build-arg CORTEX_CPP_VERSION=$(git rev-parse HEAD) -f docker/Dockerfile . |
| 34 | + |
| 35 | +# Use specific version of cortex.cpp and cortex.llamacpp |
| 36 | +docker build --build-arg CORTEX_LLAMACPP_VERSION=0.1.34 --build-arg CORTEX_CPP_VERSION=$(git rev-parse HEAD) -t menloltd/cortex -f docker/Dockerfile . |
| 37 | +``` |
| 38 | + |
| 39 | +**Run Cortex Docker Container** |
| 40 | + |
| 41 | +```bash |
| 42 | +# Create Volume to store models and data |
| 43 | +docker volume create cortex_data |
| 44 | + |
| 45 | +# GPU mode - nvidia-docker required, it will automatically use all available GPUs |
| 46 | +docker run --gpus all -it -d --name cortex -v cortex_data:/root/cortexcpp -p 39281:39281 menloltd/cortex |
| 47 | + |
| 48 | +# CPU mode |
| 49 | +docker run -it -d --name cortex -v cortex_data:/root/cortexcpp -p 39281:39281 menloltd/cortex |
| 50 | +``` |
| 51 | + |
| 52 | +**Check logs (Optional)** |
| 53 | + |
| 54 | +```bash |
| 55 | +docker logs cortex |
| 56 | +``` |
| 57 | + |
| 58 | +**Access to http://localhost:39281 to check the cortex docs API.** |
| 59 | + |
| 60 | +**Execute to container and try out cortex cli** |
| 61 | + |
| 62 | +```bash |
| 63 | +docker exec -it cortex bash |
| 64 | +cortex --help |
| 65 | +``` |
0 commit comments