CentOS commands:
> yum list installed
2) To view the count of packages installed
> yum list installed | wc -l
3) To refresh package database and install updates if any
> yum update -y
(-y is added so that you need not respond with y or yes when prompted)
4) To check if package is installed
> rpm -qa | grep <package-name>
e.g., rpm -qa | grep docker
5) To install docker
> yum install -y https://download.docker.com/linux/centos/8/x86_64/stable/Packages/containerd.io-1.4.3-3.1.el8.x86_64.rpm
> curl -fsSL https://get.docker.com/ | sh
> rpm -qa | grep docker
docker-ce-20.10.3-3.el8.x86_64
docker-ce-rootless-extras-20.10.3-3.el8.x86_64
docker-ce-cli-20.10.3-3.el8.x86_64
COURTESY: https://vexpose.blog/2020/04/02/installation-of-docker-fails-on-centos-8-with-error-package-containerd-io-1-2-10-3-2-el7-x86-64-is-excluded/
6) To start, stop and view status of docker
> systemctl start docker
> systemctl enable docker
> systemctl status docker
7) To list all containers
> docker container ls
8) To list both running and stopped containers
> docker ps -a
9) To list only stopped containers
> docker ps -a | grep Exit
10) To lists all images
> docker images -a OR docker image ls
11) To remove a container by container-id
> docker rm <first-few-chars-of-container-id>
12) Docker provides a single command that will clean up any resources — images, containers, volumes, and networks — that are dangling (not associated with a container)
> docker system prune
13) To remove a container by image-id
> docker rmi <first-few-chars-of-image-id>
14) To install a container
> docker pull docker/whalesay
15) To run container
e.g., > docker run docker/whalesay cowsay Hi
This will start the container from the image if the image is already present. If the image is not present already, it will download the image and start the container
16) To get ip address
> ifconfig
ens33: ...
inet <YOUR-IP-HERE> netmask X.X.X.X broadcast Y.Y.Y.Y
17) Find commands
> find . -type f -name filename
To find files with name filename in the current directory
> find / -type d -name directoryname
To find directories with name directoryname in the entire disk
Comments
Post a Comment