yum install -y yum-utils
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum -y install docker-ce
* To enable and start the docker service
systemctl --now enable docker
$ docker --version
$ docker version
$ docker info
$ docker search centos
$ docker pull centos:7
$ docker pull centos # It would always pull the latest version image
$ docker images
$ docker run hello-world
$ docker run -it centos (or) docker run -it centos bash
$ docker create -it centos
$ docker start -ai "container id"
$ docker pull httpd:latest
$ docker run -d -p 80:80 --name web httpd
$ docker ps
$ curl localhost
$ docker ps
$ docker ps -a
$ docker container ls
$ docker top web
$ docker inspect web
$ docker container inspect web
* To see the single container resource usage
$ docker stats web
* To see the all the containers resource usage
$ docker stats
$ docker exec -it web ls
$ docker exec -it web bash
* To stop the single container
$ docker stop web
* To stop all the containers
$ docker stop $(docker ps -aq)
$ docker kill web
$ docker kill $(docker ps -aq)
$ docker rm web
$ docker rm $(docker ps -aq)
$ docker rmi httpd
$ docker rmi -f httpd
$ docker rmi -f $(docker images -aq)
$ docker system prune # Just delete the stopped containers and build cache
$ docker system prune --volumes # Delete everything excluding images
$ docker system prune -a --volumes # Delete everything [Images, vol, network, containers]
certificate error message:
docker: Error response from daemon: Get "https://registry-1.docker.io/v2/": x509: certificate signed by unknown authority.
fix: update zscaler certificate through vagrant provision and restart the docker daemon