Docker

Commands

sudo docker –version

sudo docker pull

sudo docker run

The following command allows to create a container from an image.

sudo docker ps

This command lists the running containers.

sudo docker ps -a

This command lists all running and exited containers.

sudo docker stop <container ID>

Upon completion, the command returns the <container ID> which has been successfully stopped.

sudo docker kill <container ID>

To be used when the ‘stop’ command takes too long to complete.

sudo docker images

This command lists all images

sudo docker rm <container ID>

This command removes the container identified by the <container ID>

sudo docker rmi <image ID>

This command removes the image identified by <image ID>

sudo docker restart [OPTIONS] <container ID>

This command is used to restart a container.