docker ps --filter "status=exited" | grep 'weeks ago' | awk '{print $1}' | xargs --no-run-if-empty docker rm
docker ps --filter "status=exited" | awk '{print $1}' | xargs --no-run-if-empty docker rm
copy file from container to host
$docker cp <container-id>:/usr/lib/python2.7/dist-packages/openerp/addons addons
odoo 10
$docker cp <container-id>:/usr/lib/python2.7/dist-packages/odoo/addons addons
odoo11
/usr/lib/python3/dist-packages/odoo/addons
How to remove <none> images after building
docker rmi $(docker images -f "dangling=true" -q)
docker ps -a | cut -c-12 | xargs docker rm
To remove all containers we can use the following command:
docker rm -f $(docker ps -aq)
docker rm is command to remove container.
-f flag (for rm) is to stop container if it’s running (force deletion).
-q flag (for ps) is to print only container IDs.
-p is a ports mapping HOST PORT:CONTAINER PORT.
-v is a volume mounting HOST DIRECTORY:CONTAINER DIRECTORY.
To remove all dangling Docker images:
sudo docker rmi $(sudo docker images -f "dangling=true" -q)
If run as root omit "sudo"
docker rmi $(docker images -f "dangling=true" -q)
Remove non-running Docker containers
docker ps -a | cut -c-12 | xargs docker rmTo remove all containers we can use the following command:
docker rm -f $(docker ps -aq)
docker rm is command to remove container.
-f flag (for rm) is to stop container if it’s running (force deletion).
-q flag (for ps) is to print only container IDs.
-p is a ports mapping HOST PORT:CONTAINER PORT.
-v is a volume mounting HOST DIRECTORY:CONTAINER DIRECTORY.
To remove all dangling Docker images:
sudo docker rmi $(sudo docker images -f "dangling=true" -q)
If run as root omit "sudo"
docker rmi $(docker images -f "dangling=true" -q)