DEV Community

tShan
tShan

Posted on

Docker installation on Linux and practice

$ sudo apt-get update

$ sudo apt install docker.io

(asking you to choose between y/n - choose y)

$ docker --version
to check the verstion

Pull an image from the Docker hub using the following command:
$ sudo docker run hello-world

$ docker images
to see a list of all images on your system.

$ docker run busybox
run a Docker container based on this image docker

$ docker run busybox echo "hello from busybox"
Docker client dutifully ran the echo command in our busybox container and then exited it

$ docker ps
The docker ps command shows you all containers that are currently running.

$ docker ps -a
list of all containers that we ran

$ docker rm 305297d7a235 ff0a5c3750b9
clean up containers once I'm done with them

$ docker rm $(docker ps -a -q -f status=exited)
This command deletes all containers that have a status of exited

$ docker container prune
This will remove all stopped containers

Top comments (0)