瀏覽代碼

增加端口映射

lxylxy123321 1 周之前
父節點
當前提交
c7cb2bbaba
共有 2 個文件被更改,包括 18 次插入51 次删除
  1. 12 6
      docker-compose.yml
  2. 6 45
      result.txt

+ 12 - 6
docker-compose.yml

@@ -13,7 +13,8 @@ services:
       - pgdata:/var/lib/postgresql/data
     ports:
       - "5432:5432"
-    network_mode: host
+    networks:
+      - finetune-net
 
   backend:
     build:
@@ -21,8 +22,6 @@ services:
       dockerfile: Dockerfile
     container_name: finetune-backend
     restart: unless-stopped
-    ports:
-      - "8010:8010"
     volumes:
       - ./backend/data:/home/ubuntu/Fine-tuning/backend/data
     env_file:
@@ -30,7 +29,9 @@ services:
     environment:
       - BACKEND_HOST=0.0.0.0
       - BACKEND_PORT=8010
-      - DATABASE_URL=postgresql+asyncpg://finetune:finetune123@localhost:5432/finetuning
+      - DATABASE_URL=postgresql+asyncpg://finetune:finetune123@postgres:5432/finetuning
+    ports:
+      - "8010:8010"
     deploy:
       resources:
         reservations:
@@ -38,9 +39,10 @@ services:
             - driver: nvidia
               count: all
               capabilities: [gpu]
-    network_mode: host
     depends_on:
       - postgres
+    networks:
+      - finetune-net
 
   frontend:
     build:
@@ -52,7 +54,11 @@ services:
     container_name: finetune-frontend
     restart: unless-stopped
     ports:
-      - "5173:80"
+      - "80:80"
+
+networks:
+  finetune-net:
+    driver: bridge
 
 volumes:
   pgdata:

+ 6 - 45
result.txt

@@ -1,45 +1,6 @@
-ubuntu@ubuntu:/home$ cd ubuntu/
-ubuntu@ubuntu:~$ cat /etc/os-release
-PRETTY_NAME="Ubuntu 24.04.3 LTS"
-NAME="Ubuntu"
-VERSION_ID="24.04"
-VERSION="24.04.3 LTS (Noble Numbat)"
-VERSION_CODENAME=noble
-ID=ubuntu
-ID_LIKE=debian
-HOME_URL="https://www.ubuntu.com/"
-SUPPORT_URL="https://help.ubuntu.com/"
-BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
-PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
-UBUNTU_CODENAME=noble
-LOGO=ubuntu-logo
-ubuntu@ubuntu:~$ df -h
-Filesystem                         Size  Used Avail Use% Mounted on
-tmpfs                              3.1G  1.4M  3.1G   1% /run
-/dev/mapper/ubuntu--vg-ubuntu--lv  298G   49G  250G  17% /
-tmpfs                               12G     0   12G   0% /dev/shm
-tmpfs                              5.0M     0  5.0M   0% /run/lock
-/dev/sda2                          2.0G  101M  1.7G   6% /boot
-tmpfs                              1.6G   20K  1.6G   1% /run/user/1000
-ubuntu@ubuntu:~$ nvidia-smi
-Wed May 20 06:43:18 2026       
-+-----------------------------------------------------------------------------------------+
-| NVIDIA-SMI 580.159.03             Driver Version: 580.159.03     CUDA Version: 13.0     |
-+-----------------------------------------+------------------------+----------------------+
-| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
-| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
-|                                         |                        |               MIG M. |
-|=========================================+========================+======================|
-|   0  NVIDIA GeForce RTX 3090        Off |   00000000:00:0A.0 Off |                  N/A |
-| 30%   27C    P8             16W /  350W |       1MiB /  24576MiB |      0%      Default |
-|                                         |                        |                  N/A |
-+-----------------------------------------+------------------------+----------------------+
-
-+-----------------------------------------------------------------------------------------+
-| Processes:                                                                              |
-|  GPU   GI   CI              PID   Type   Process name                        GPU Memory |
-|        ID   ID                                                               Usage      |
-|=========================================================================================|
-|  No running processes found                                                             |
-+-----------------------------------------------------------------------------------------+
-ubuntu@ubuntu:~$ 
+ubuntu@ubuntu:~/Fine-tuning$ docker ps
+CONTAINER ID   IMAGE                                             COMMAND                  CREATED          STATUS                          PORTS                                           NAMES
+3c0846dac9d1   fine-tuning-backend                               "uvicorn main:app --…"   2 minutes ago    Restarting (1) 26 seconds ago                                                   finetune-backend
+23db26d14e52   fine-tuning-frontend                              "/docker-entrypoint.…"   2 minutes ago    Restarting (1) 36 seconds ago                                                   finetune-frontend
+850384c68fed   docker.m.daocloud.io/library/postgres:16-alpine   "docker-entrypoint.s…"   2 minutes ago    Up 2 minutes                                                                    finetune-postgres
+c2ec724f96b0   mineru:latest                                     "mineru-api --host 0…"   22 minutes ago   Up 22 minutes (healthy)         0.0.0.0:23428->8000/tcp, [::]:23428->8000/tcp   mineru-api