我要评分
获取效率
正确性
完整性
易理解

Uninstalling Docker

Perform the following steps to uninstall Docker:

  1. Delete all running containers.
    1
    docker rm -vf $(docker ps -a -q)
    

    To back up a running container, run the docker commit command to save the container as an image.

    1
    docker commit -m "<message>" -a "<author>" <Container ID> <Image name>:<tag>
    

    The backup of image will be described in the following.

  2. Delete all local images.
    1
    docker rmi -f $(docker images -a -q)
    

    To back up a Docker image to a local file, run the docker save command to save the image as a .rar file.

    1
    docker save -o <File name>.rar <Image name>:<tag>
    
  3. Delete the Docker components from /usr/bin.
    1. Query the Docker components in /usr/bin.
      1
      ll
      

    2. Delete these components in sequence.
      1
      rm -f /usr/bin/<Component name>
      
  4. Reset the docker.service configuration file.
    1. Clear the docker.service file.
      1
      echo '' >  /usr/lib/systemd/system/docker.service
      
    2. Reload the daemon service.
      1
      systemctl daemon-reload
      

      Docker is uninstalled.