# docker中的gradio無法存取 最近執行一個專案,會在docker容器中安裝grdio,一個可以快速建構的web gui  執行預設會在port 7860,docker-compose.yaml中是這樣把port連進去的 ```yaml ports: "7860:7860" ``` 但實際存取後發現無法訪問,如下 所以我一開始只能用public url進去使用  找了很久問題一直以為是防火牆的原因 問了chatgpt也找不到正解== 後來用了別的程式才發現根本沒有防火牆的問題存在XD 所以上網查了一下才知道要特別指定environment變數,如下 ```yaml environment: - GRADIO_SERVER_NAME=0.0.0.0 - GRADIO_SERVER_PORT=7860 ``` 最終修改完的`docker-compose.yaml` (for MobileSAM) ```yaml= services: mobilesam: stdin_open: true tty: true devices: - /dev/dri volumes: - .:/root/MobileSAM ports: - "7860:7860" deploy: resources: reservations: devices: - driver: nvidia count: all capabilities: - gpu environment: - QT_X11_NO_MITSHM=1 - NVIDIA_VISIBLE_DEVICES=all - NVIDIA_DRIVER_CAPABILITIES=all - GRADIO_SERVER_NAME=0.0.0.0 - GRADIO_SERVER_PORT=7860 container_name: mobilesam-container build: . image: frakw/mobilesam:latest command: /bin/bash ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up