首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >试图在Docker组合文件中设置卷时出错

试图在Docker组合文件中设置卷时出错
EN

Stack Overflow用户
提问于 2022-09-13 03:13:54
回答 1查看 249关注 0票数 0

我正在尝试运行一个docker-compose文件,并试图将volumes添加到下面所示的config文件夹中,但是我在下面得到了错误消息。我在Windows10上运行Ubuntu20.04。我从设置home directoryvolumes:部分中得到错误。Docker要求我使用绝对路径来定义卷。docker-compose文件的内容如下所示。我怎么才能解决这个问题?

错误:

代码语言:javascript
复制
edge@D-O5F1K:/mnt/c/Users/Edge/Desktop/Docker-Linux-Containers$ docker compose up -d
[+] Running 0/1
 ⠹ Container webtop  Creating                                              2.2s 
Error response from daemon: invalid volume specification: '/run/desktop/mnt/host/wsl/docker-desktop-bind-mounts/Ubuntu-20.04/8c2793a7f76fcc2d6e6ac4f4109fe56011c82cba08a35e2d775e546876c17da8:config:rw': invalid mount config for type "bind": 
invalid mount path: 'config' mount path must be absolute

docker-compose文件内容:

代码语言:javascript
复制
version: "2.1"
services:
  heimdall:
    image: ghcr.io/linuxserver/webtop:ubuntu-mate #choose a tag
    container_name: webtop
    #priviledged: true #optional but not needed unless you are running kde or i3 or other tools
    volumes:
      - /mnt/c/Users/Edge/Desktop/Docker-Linux-Containers/config:config #home directory
      #- /var/run/docker.sock:var/run/docker.sock #optional
    environment:
      - PUID=1000 #based on id
      - PGID=1000 #based on group
      - TZ=Canada/Toronto #your timezone
    ports:
      - 3000:3000
    shm_size: "3gb" #optional but set to 1gb or higher to prevent browser crashes 
    restart: unless-stopped #restart on error 

树:

代码语言:javascript
复制
.
├── README.md
├── config
└── docker-compose.yml

用于运行容器的命令:

代码语言:javascript
复制
docker compose up -d
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-09-13 04:11:13

错误是'config' mount path must be absolute

用容器中配置的绝对路径替换/mnt/c/../config:config中的/mnt/c/../config:config

例如/mnt/c/../config:/home/user/config

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73697183

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档