当我使用 nerdctl 运行“compose up”时,出现以下错误。 怎么解决这个问题?
sudo nerdctl compose up
WARN[0000] Ignoring: service deepstream-peoplenet: [Tty]
WARN[0000] Ignoring: volume: Bind: [CreateHostPath]
WARN[0000] Ignoring: volume: Bind: [CreateHostPath]
WARN[0000] Ignoring: volume: Bind: [CreateHostPath]
INFO[0000] Ensuring image peoplenet-on-deepstream_deepstream-peoplenet
INFO[0000] Creating container deepstream-peoplenet
FATA[0000] name "deepstream-peoplenet" is already used by ID "5d1a1e7b97425da55d1967b5c5a4506596452bd353d097d2f3cf6002e7aba3b5"
FATA[0000] error while creating container deepstream-peoplenet: exit status 1
发生错误的原因是 名称“deepstream-peoplenet”已被 ID“5d1a1e7b97425da55d1967b5c5a4506596452bd353d097d2f3cf6002e7aba3b5”使用
也许如果你删除以前具有该名称的容器,comand compose up 就会成功运行。
类似这样的:
nerdctl rm deepstream-peoplenet
我不知道这是否是与在具有 WSL 的系统中在 docker-compose.yaml 中创建卷有关的问题,如果是我遇到了同样的问题,解决方案是使用卷模式声明
我的例子:
version: "3"
volumes:
mysql_data:
services:
db:
image: mysql:5.7
command: --inodb-use-native-aio=0
container_name: db
restart: always
tty: true
volumes:
- type: volume
target: /var/lib/mysql
source: mysql_data
environment:
- MYSQL_DATABASE=nodedb
- MYSQL_ROOT_PASSWORD=root
- MYSQL_USER=root
networks:
- node-network
networks:
node-network:
driver: bridge
enter code here
我在这些链接中找到了解决方案:
如果您通过 rancher Desktop 使用 nerdctl,则 rdctl shell sudo -i 进入 shell,并且可以在该 shell 中使用 sudo nerdctl。类似在利马拥有超级特权