# Docker Images Repo

repo for storage any useful SaaS oriented on containers -> Enjoy!

## Docker & Docker Compose Installation

firstly you need docker:

```bash
apt-get install docker.io
yum install docker.io
pacman -S docker
```

next step is docker-compose installation:

```bash
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version
```

## Docker & Docker Compose Configure

you can use docker / docker-compose with sudo but you can add your user to ```docker``` group, and use docker straightly, like that:

```bash
sudo groupadd docker
sudo usermod -aG docker $USER && newgrp docker
```

is likely you need rebot for save permission changes.

also important thing is configure systemctl for running docker on boot with systemd:

```bash
sudo systemctl enable docker.service && sudo systemctl enable docker
sudo systemctl start docker
sudo systemctl status docker
```

otherwise you can disable docker auto runner with systemd:
```bash
sudo systemctl disable docker.service && sudo systemctl disable docker
```

## Docker Cleaning

you can clean docker objects separetly, but removing every objects are more comfortable:

```bash
docker system prune --volumes
```

## Minikube installation

Alternatively you can install minikube and deploy all of docker-compose configurations via k8s

```bash
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube
```

you can start it like that:

```bash
minikube start
```

after that you have to install kubectl separately or use it by minikube facade:

```bash
kubectl get po -A

# OR

minikube kubectl -- get po -A
```

more information: https://minikube.sigs.k8s.io/docs/start/

## Convert Docker-Compose Configs to Kubernetes Resources

you can install ```kompose``` for do that:

```bash
curl -L https://github.com/kubernetes/kompose/releases/download/v1.26.0/kompose-linux-amd64 -o kompose
chmod +x kompose
sudo mv ./kompose /usr/local/bin/kompose
```

go to particular service directory and execute this one:

```bash
kompose convert
```

after that execute this one:

```bash
kubectl apply -f <output file>
```

```<output file>``` means all of generated files separated by ```,``` like that for e.g.:

```bash
kubectl apply -f frontend-tcp-service.yaml,redis-master-service.yaml,redis-slave-service.yaml,frontend-deployment.yaml,redis-master-deployment.yaml,redis-slave-deployment.yaml
```

more information: https://kubernetes.io/docs/tasks/configure-pod-container/translate-compose-kubernetes/