Cool Docker Commands

Cool Docker Commands

Basic Commands

1. docker images Lists images.

2. docker ps Lists containers.

Remove all images from Containers

docker container rm -f $(docker container ls -aq)

-f flag forcefully removes containers including the running containers.

-q flag lists the IDs of the containers

-a flag includes the IDs of stopped containers also.

We can also combine them like so -aq.

Remove all images from Docker

You may want to remove containers because you might get an error if some images are being used in containers.

docker image rm $(docker image ls -q)

docker image ls lists are images

& the -q flag lists the image IDs only.

Passing that list to the rm command removes the images.

JAMSTACK is
Awesome

Obsessed with Technology.

This site is built on JAMStack architecture:
GhostJS as headless CMS & content API,
GatsbyJS for Static Site Generation (SSG ), GitHub Actions for CI/CD.
NodeJS , ReactJS & GraphQL

© 2023 — Mursaleen