Get the error when run "compose up" with nerdctl

2.6k Views Asked by At

I get the following error when I run "compose up" with nerdctl. How can this be resolved?

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
2

There are 2 best solutions below

1
On

if you use nerdctl via rancher Desktop , rdctl shell sudo -i to enter shell and sudo nerdctl can be used in this shell . it similiar in lima to have super privilege

0
On

The error is occouring because name "deepstream-peoplenet" is already used by ID "5d1a1e7b97425da55d1967b5c5a4506596452bd353d097d2f3cf6002e7aba3b5"

Maybe if you delete the previrous container with this name, the comand compose up will run successfully.

Something like this:

nerdctl rm deepstream-peoplenet

I do not know if it is a problem related create a volume in docker-compose.yaml in a system with WSL, if it is I was with the same problem, a solution is use the volume mode declaration

My example:

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

I found the solution in these links: