Docker Commands
With Docker, you can interact and work in a client-server environment since it’s Linux-based.
Here are some Docker commands you should know.
Docker version
$ docker version As shown in the following image, it shows the docker version for both client and server.

Create a Docker image from a Dockerfile
$ docker build -t image-name docker-file-location -t : tags Docker images with a name.
Run the Docker image
$ docker run -d image-name -d : Creates a daemon.
Available docker images
$ docker images
Latest running container
$ docker ps -l -l : it is used to show latest available container.
All running containers
$ docker ps -a -a : It shows all the containers.
Stop running container
$ docker stop container_id container_id : This is the Id Docker assigns to the container.
Delete an image
$ docker rmi image-name
Delete all images
$ docker rmi $(docker images -q)
Delete all images forcefully
$ docker rmi -f $(docker images -q) -f : It’s used to forcefully delete images.
Delete all containers
$ docker rm $(docker ps -a -q)
Enter into Docker container
$ docker exec -it container-id bash