skip to Main Content

I want delete containers in docker (Ubuntu 22.04)

I try like a user, and like a root: otherwise, I get the same result.

docker ps -a    
docker container ls 

exec: "com.docker.cli": executable file not found in $PATH
Current PATH : /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/anatoly

2

Answers


  1. Get Container ID:

    docker ps -a
    

    Force delete Container ( will delete it even if it’s running)

    docker container rm -f $CONTAINER_ID
    

    To seel all other available options:
    https://docs.docker.com/engine/reference/commandline/rm/

    Login or Signup to reply.
  2. You must reproduce this
    Login as a root

    sudo su -
    

    Go to
    cd /var/lib/docker

    Now if you ls,you should get

    drwx--x--x   4 root root  4096 феб 27  2022 buildkit
    drwx--x--- 101 root root 12288 сеп 23 11:48 containers
    drwx------   3 root root  4096 феб 27  2022 image
    drwxr-x---   3 root root  4096 феб 27  2022 network
    drwx--x--- 879 root root 94208 окт  2 06:52 overlay2
    drwx------   4 root root  4096 феб 27  2022 plugins
    drwx------   2 root root  4096 окт  2 06:52 runtimes
    drwx------   5 root root  4096 окт  2 06:52 swarm
    drwx------   2 root root  4096 окт  2 06:52 tmp
    drwx------   2 root root  4096 феб 27  2022 trust
    drwx-----x  57 root root  4096 окт  2 06:52 volumes
    

    You have here whole thruth about containers ,volumes and etc.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search