Docker
Continuous Integration (CI) and Continuous Deployment (CD) are essential practices in modern software development. Going through docker again
Images Storage
By default, Docker stores images in /var/lib/docker
To check the storage driver Docker is using
The specific path depends on the storage driver Docker is using. For example, if you're using the overlay2 storage driver, the images are stored in:
docker info | grep "Storage Driver"
Storage Driver: overlay2

docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
docker rmi $(docker images -f "dangling-true" -q)
docker volume rm $(docker volume ls -f dangling=true -q)
docker images --format '{{.Size}}\t{{.Repository}}\t{{.Tag}}\t{{.ID}}' | sed 's/ //' | sort -h | column -t
1.24MB busybox latest bc01a3326866
18.6MB gns3/openvswitch latest 64b5202d0623
56.4MB google/shaka-packager latest fbda4f81f776
117MB redis latest f9c173b0f012
202MB postgres 10 1cad456b3a24
216MB postgres 14-alpine 664ff9e724c9
218MB ffmpeg-multicast latest 3a2431803ae8
218MB jrottenberg/ffmpeg latest 2100506dfbea
331MB docker latest ca9c20c1e8a7
429MB zabbix/zabbix-server-pgsql centos-6.2-latest fa3ddcfd31c5
546MB zabbix/zabbix-web-nginx-pgsql centos-6.2-latest 93498dc51b1f
1.06GB terratrax/scannerapi latest 3b08ad5fff14
1.3GB ansible/awx 14.1.0 8a29b4e35f5f
Run a shell
alias ubund='docker run --name ubuntu -it 1ce8erg0/ubuntu:16.04 bash'
# Use an official Python runtime as a parent image
FROM python:3.8-slim
# Set the working directory
WORKDIR /app
# Copy the current directory contents into the container
COPY . /app
# Install any needed packages
RUN pip install -r requirements.txt
# Run the app when the container starts
CMD ["python", "app.py"]
The repository 'https://apt.kubernetes.io' kubernetes-focal Release' does not have a Release file.

sudo apt update
sudo apt install -y apt-transport-https ca-certificates curl net-tools
sudo apt install docker.io
sudo systemctl start docker
sudo systemctl enable docker
echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.28/deb/ /" | sudo tee /etc/apt/sources.list.d/kubernetes.list
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.28/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
sudo apt-get update
sudo hostnamectl set-hostname kubernetes-master
K8S installation
sudo swapoff -a
sudo apt install -y kubelet kubeadm kubectl
sudo apt-mark hold kubelet kubeadm kubectl
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
kubelet --version
kubectl version --client
kubeadm version
sudo kubeadm init --apiserver-advertise-address=192.168.56.10 --pod-network-cidr=192.168.0.0/16
export KUBECONFIG=/etc/kubernetes/admin.conf
kubectl get pods -n kube-system
sudo systemctl restart kubelet
sudo journalctl -u kubelet -f
kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml
I0914 08:47:44.807948 1764 version.go:256] remote version is much newer: v1.31.0; falling back to: stable-1.28
[init] Using Kubernetes version: v1.28.13
[preflight] Running pre-flight checks
[WARNING FileExisting-socat]: socat not found in system path
[preflight] Pulling images required for setting up a Kubernetes cluster
[preflight] This might take a minute or two, depending on the speed of your internet connection
[preflight] You can also perform this action in beforehand using 'kubeadm config images pull'
kubeadm token create --print-join-command
kubeadm join 10.0.2.15:6443 --token o1i282.fofbqewf8jys3xkk --discovery-token-ca-cert-hash sha256:907deb30877b3566dee7c39a4da03b47b6e6a08c37aeb959a2a231090ca433b3
Your Kubernetes control-plane has initialized successfully!
To start using your cluster, you need to run the following as a regular user:
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
Alternatively, if you are the root user, you can run:
export KUBECONFIG=/etc/kubernetes/admin.conf
You should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
https://kubernetes.io/docs/concepts/cluster-administration/addons/
Then you can join any number of worker nodes by running the following on each as root:
kubeadm join 192.168.56.10:6443 --token e48ljd.kf2sij6e16dapbv9 \
--discovery-token-ca-cert-hash sha256:2c07edaed836a06c8f75b234f82aa7f5d41eb838956b7d50d33eab551a821603
View the kubeadm Configuration File The configuration details generated during kubeadm init are typically stored in /etc/kubernetes/admin.conf.
kubectl cluster-info
kubeadm token list
kubectl get nodes
kubectl get cm -n kube-system kubeadm-config -o yaml > kubeadm-config.yaml
kubeadm reset
root@focal:~# rm -rf ~/.kube/ /etc/kubernetes/ /etc/cni/
kubernetes-master:~$ kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
kubernetes-master:~$ kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/k8s-manifests/kube-flannel-rbac.yml
kubernetes-master:~$ kubectl get pods --all-namespaces
kubernetes-worker:~$ sudo kubeadm join 192.168.1.220:6443 --token 1exb8s.2t4k3b5syfc3jfmo --discovery-token-ca-cert-hash sha256:72ad481cee4918cf2314738419356c9a402fb609263adad48c13797d0cba2341
kubernetes-master:~$ kubectl apply -f https://k8s.io/examples/controllers/nginx-deployment.yaml
kubernetes-master:~$ kubectl run --image=nginx nginx-server --port=80 --env="DOMAIN=cluster"
kubernetes-master:~$ kubectl expose deployment nginx-deployment --port=80 --name=nginx-http
kubernetes-master:~$ kubectl get svc
https://linuxconfig.org/how-to-install-kubernetes-on-ubuntu-22-04-jammy-jellyfish-linux