Skip to content

Cannot start previously stopped containers (plugin type=\"bridge\" failed (add): failed to allocate for range 0: 10.4.0.4 has been allocated to default-XXXX, duplicate allocation is not allowed") #665

Closed

Description

@max-wittig

Similar to #492

System

macOS 12.1

nerdctl version                                                                                                                             
Client:
 Version:       v0.15.0
 Git commit:    b72b5ca14550b2e23a42787664b6182524c5053f

Server:
 containerd:
  Version:      v1.5.8-k3s1
  GitCommit:

How to reproduce

  1. Start container: e.g.: nerdctl run -d -e POSTGRES_PASSWORD=postgres -p 5432:5432 postgres:latest
  2. Stop your container runtime (e.g. Rancher Desktop)
  3. Start your container runtime
  4. Show existing containers nerdctl ps --all
  5. Try to start the existing container
nerdctl start dff170a6c9b1
FATA[0000] failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:545: container init caused: Running hook #0:: error running hook: exit status 1, stdout: , stderr: time="2022-01-04T15:11:37Z" level=fatal msg="failed to call cni.Setup: plugin type=\"bridge\" failed (add): failed to allocate for range 0: 10.4.0.4 has been allocated to default-dff170a6c9b146701bba04d19ecfc27ae5a26374aeccc87be2f6b1a7993e537a, duplicate allocation is not allowed"
Failed to write to log, write /var/lib/nerdctl/dbb19c5e/containers/default/dff170a6c9b146701bba04d19ecfc27ae5a26374aeccc87be2f6b1a7993e537a/oci-hook.createRuntime.log: file already closed: unknown

Activity

  1. junnplus commented on Jan 5, 2022

    @junnplus
  2. max-wittig commented on Jan 5, 2022

    @max-wittig
    Author

    @junnplus Okay interesting. I didn't see that issue with this context, but it could make sense. Should I close this one then?

  3. AkihiroSuda commented on Jan 5, 2022

    @AkihiroSuda
    Member

    #458 is for rootless, but the OP seems rootful, so not a duplicate

  4. changed the title [-]Cannot start previously stopped containers[/-] [+]Cannot start previously stopped containers (`plugin type=\"bridge\" failed (add): failed to allocate for range 0: 10.4.0.4 has been allocated to default-XXXX, duplicate allocation is not allowed"`)[/+] on Jan 5, 2022
  5. added
    bug
    on Jan 5, 2022
  6. junnplus commented on Jan 5, 2022

    @junnplus
    Member

    I'm sorry for i didn't double check :(

    I reproduced this issue, the task status will be displayed as Created after restart qemu.

  7. max-wittig commented on Jan 11, 2022

    @max-wittig
    Author

    Update: It actually works after a few tries, so after 3-4 times nerdctl start f01efaea7cce, it works.

  8. stan-shih commented on Feb 15, 2022

    @stan-shih
    > nerdctl start devOraDB
    FATA[0000] failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:545: container init caused: Running hook #0:: error running hook: exit status 1, stdout: , stderr: time="2022-02-15T10:02:36Z" level=fatal msg="failed to call cni.Setup: plugin type=\"bridge\" failed (add): failed to allocate for range 0: 10.4.0.3 has been allocated to default-418e62d24bcd44f0be76e13a7c05ded9140c9cf956d068193042c4b9ed5b5108, duplicate allocation is not allowed"
    Failed to write to log, write /var/lib/nerdctl/dbb19c5e/containers/default/418e62d24bcd44f0be76e13a7c05ded9140c9cf956d068193042c4b9ed5b5108/oci-hook.createRuntime.log: file already closed: unknown
    > nerdctl ps -a
    CONTAINER ID    IMAGE                                                  COMMAND                   CREATED              STATUS     PORTS                     NAMES
    418e62d24bcd    docker.io/store/oracle/database-enterprise:12.2.0.1    "/bin/sh -c /bin/bas…"    About an hour ago    Created    0.0.0.0:1521->1521/tcp    devOraDB
    8cfcd3da9696    docker.io/library/nginx:alpine                         "/docker-entrypoint.…"    8 minutes ago        Up         0.0.0.0:8080->80/tcp      nginx
    > nerdctl start 418e62d24bcd
    418e62d24bcd
    > nerdctl ps
    CONTAINER ID    IMAGE                                                  COMMAND                   CREATED              STATUS    PORTS                     NAMES
    418e62d24bcd    docker.io/store/oracle/database-enterprise:12.2.0.1    "/bin/sh -c /bin/bas…"    About an hour ago    Up        0.0.0.0:1521->1521/tcp    devOraDB
    8cfcd3da9696    docker.io/library/nginx:alpine                         "/docker-entrypoint.…"    9 minutes ago        Up        0.0.0.0:8080->80/tcp      nginx

    OS: Windows 10 21H1
    nerdctl version: 0.16.1

  9. elegorod commented on Jun 2, 2022

    @elegorod

    Also have same issue on Windows.

  10. Jiahonzheng commented on Sep 10, 2022

    @Jiahonzheng

    Any updates?😭

  11. AkihiroSuda commented on Sep 10, 2022

    @AkihiroSuda
    Member

    Any updates?😭

    Needs a reproducer

  12. added
    status/needs-more-information
    on Sep 10, 2022
  13. jandubois commented on Jan 5, 2023

    @jandubois
    Contributor

    Needs a reproducer

    @AkihiroSuda I can reproduce it consistently on macOS Monterey (Intel) with Lima 0.14.2:

    $ limactl --version
    limactl version 0.14.2
    
    $ limactl start --tty=false
    [...]
    
    $ nerdctl.lima --version
    nerdctl version 1.1.0
    
    $ nerdctl.lima run -d --name nginx -p 8080:80 nginx
    [...]
    cae8a90f488edbe1a54cb23d05065873f3d0bc1c55ed21ac162aff6f9971895b
    
    $ curl -s http://localhost:8080 | grep Welcome
    <title>Welcome to nginx!</title>
    <h1>Welcome to nginx!</h1>
    
    $ limactl stop
    [...]
    
    $ limactl start
    [...]
    
    $ nerdctl.lima ps -a
    CONTAINER ID    IMAGE                             COMMAND                   CREATED               STATUS     PORTS                   NAMES
    cae8a90f488e    docker.io/library/nginx:latest    "/docker-entrypoint.…"    About a minute ago    Created    0.0.0.0:8080->80/tcp    nginx
    
    $ nerdctl.lima start nginx
    FATA[0000] failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error running hook #0: error running hook: exit status 1, stdout: , stderr: time="2023-01-05T22:10:10Z" level=fatal msg="failed to call cni.Setup: plugin type=\"bridge\" failed (add): failed to allocate for range 0: 10.4.0.2 has been allocated to default-cae8a90f488edbe1a54cb23d05065873f3d0bc1c55ed21ac162aff6f9971895b, duplicate allocation is not allowed"
    Failed to write to log, write /home/jan.linux/.local/share/nerdctl/1935db59/containers/default/cae8a90f488edbe1a54cb23d05065873f3d0bc1c55ed21ac162aff6f9971895b/oci-hook.createRuntime.log: file already closed: unknown

    As mentioned above, the command will eventually succeed if you retry a couple of times.

    Restarting the VM seems to be an essential step; I have not been able to reproduce it by simply stopping the container.

    The issue happens with both rootful and rootless installations of containerd, and can be reproduced on Alpine as well (using Rancher Desktop).

  14. jandubois commented on Jan 5, 2023

    @jandubois
    Contributor

    Note that the container restarts properly if you deploy it with --restart=always:

    $ nerdctl.lima run -d --name nginx --restart=always -p 8080:80 nginx
    d761b17ffe563acb55fa5c557b5e5c6d572666b350f5e39ce1f0c4c3a77de3c4
    
    $ curl -s http://localhost:8080 | grep Welcome
    <title>Welcome to nginx!</title>
    <h1>Welcome to nginx!</h1>
    
    $ limactl stop
    [...]
    
    $ limactl start
    [...]
    
    $ nerdctl.lima ps -a
    CONTAINER ID    IMAGE                             COMMAND                   CREATED               STATUS    PORTS                   NAMES
    d761b17ffe56    docker.io/library/nginx:latest    "/docker-entrypoint.…"    About a minute ago    Up        0.0.0.0:8080->80/tcp    nginx
    
    $ curl -s http://localhost:8080 | grep Welcome
    <title>Welcome to nginx!</title>
    <h1>Welcome to nginx!</h1>
  15. added
    help wanted
    and removed
    status/needs-more-information
    on Jan 5, 2023
  16. aogg commented on Feb 7, 2023

    @aogg

    agent

  17. litcc commented on Mar 8, 2023

    @litcc

    About the problem of restarting the container after stopping, this error has been there for most of the year, I have this problem is in every boot, restarting the corresponding container will report an error, but when you start again can start normally

    I use rootless containers

    image

    Hmm... About the docker in the picture, it's actually a call to nerdctl, I set alias docker='nerdctl' in the shell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bughelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions