Compare commits
4
Commits
e459ad23de
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3ec5ba6294 | ||
|
|
f61f22c7c4 | ||
|
|
c56ae9b7a8 | ||
|
|
e0928dac6f |
No files matched your search
@@ -0,0 +1,22 @@
|
||||
```bash
|
||||
sudo dnf config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo
|
||||
sudo dnf -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
||||
|
||||
systemctl --now enable docker
|
||||
systemctl status docker
|
||||
```
|
||||
|
||||
|
||||
Docker images go into `/var/lib/docker`. To move it on other file system, for example `/app/docker`:
|
||||
|
||||
```bash
|
||||
systemctl stop docker
|
||||
systemctl status docker
|
||||
|
||||
cd /var/lib/
|
||||
mv docker /app/
|
||||
ln -s /app/docker .
|
||||
|
||||
systemctl start docker
|
||||
systemctl status docker
|
||||
``
|
||||
@@ -0,0 +1,94 @@
|
||||
|
||||
## DNS enteries:
|
||||
```text
|
||||
ivera-db1 IN A 192.168.0.109
|
||||
ivera-db2 IN A 192.168.0.110
|
||||
ivera-db-vip IN A 192.168.0.115
|
||||
```
|
||||
|
||||
|
||||
## Master node
|
||||
|
||||
File `docker-compose.yml`:
|
||||
```yml
|
||||
services:
|
||||
keepalived:
|
||||
image: osixia/keepalived:latest
|
||||
container_name: keepalived-master
|
||||
restart: unless-stopped
|
||||
network_mode: host
|
||||
cap_add:
|
||||
- NET_ADMIN
|
||||
- NET_RAW
|
||||
- NET_BROADCAST
|
||||
volumes:
|
||||
- ./keepalived.conf:/etc/keepalived/keepalived.conf:ro
|
||||
```
|
||||
|
||||
File `keepalived.conf`:
|
||||
```text
|
||||
vrrp_instance VI_1 {
|
||||
state MASTER
|
||||
interface enp1s0
|
||||
virtual_router_id 51
|
||||
priority 100
|
||||
advert_int 1
|
||||
|
||||
unicast_src_ip 192.168.0.109 # Replace with Master node's actual IP
|
||||
unicast_peer {
|
||||
192.168.0.110 # Replace with Backup node's actual IP
|
||||
}
|
||||
|
||||
authentication {
|
||||
auth_type PASS
|
||||
auth_pass secret
|
||||
}
|
||||
|
||||
virtual_ipaddress {
|
||||
192.168.0.115/24 # The shared Virtual IP (VIP)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Backup node
|
||||
|
||||
File `docker-compose.yml`:
|
||||
```yml
|
||||
services:
|
||||
keepalived:
|
||||
image: osixia/keepalived:latest
|
||||
container_name: keepalived-backup
|
||||
restart: unless-stopped
|
||||
network_mode: host
|
||||
cap_add:
|
||||
- NET_ADMIN
|
||||
- NET_RAW
|
||||
- NET_BROADCAST
|
||||
volumes:
|
||||
- ./keepalived.conf:/etc/keepalived/keepalived.conf:ro
|
||||
```
|
||||
|
||||
File `keepalived.conf`:
|
||||
```text
|
||||
vrrp_instance VI_1 {
|
||||
state BACKUP
|
||||
interface enp1s0
|
||||
virtual_router_id 51
|
||||
priority 90
|
||||
advert_int 1
|
||||
|
||||
unicast_src_ip 192.168.0.110 # Replace with Backup node's actual IP
|
||||
unicast_peer {
|
||||
192.168.0.109 # Replace with Master node's actual IP
|
||||
}
|
||||
|
||||
authentication {
|
||||
auth_type PASS
|
||||
auth_pass secret
|
||||
}
|
||||
|
||||
virtual_ipaddress {
|
||||
192.168.0.115/24 # The shared Virtual IP (VIP)
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -1,49 +0,0 @@
|
||||
Install Docker
|
||||
--------------
|
||||
|
||||
dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
|
||||
dnf install -y docker-ce --nobest
|
||||
|
||||
systemctl enable --now docker
|
||||
systemctl status docker
|
||||
|
||||
|
||||
Docker is installed by default on `/var/lib/docker`. To move it on other file system, for example `/app/docker`:
|
||||
|
||||
systemctl stop docker
|
||||
|
||||
cd /var/lib/
|
||||
mv docker /app/
|
||||
ln -s /app/docker .
|
||||
|
||||
systemctl start docker
|
||||
systemctl status docker
|
||||
|
||||
Usefull commands
|
||||
----------------
|
||||
|
||||
Alias to stop and remove all containers:
|
||||
|
||||
alias cclean='docker stop $(docker ps -a -q); docker rm $(docker ps -a -q)'
|
||||
|
||||
Truncate all container logs:
|
||||
|
||||
truncate -s 0 $(docker inspect --format='{{.LogPath}}' $(docker ps -a -q))
|
||||
|
||||
Save an image:
|
||||
|
||||
docker save sabnzbd/sabnzbd | pigz > /mnt/yavin4/tmp/sabnzbd.tar.gz
|
||||
|
||||
Load an image:
|
||||
|
||||
gunzip -c /mnt/yavin4/tmp/sabnzbd.tar.gz | docker load
|
||||
|
||||
Set auto start for all host containers:
|
||||
|
||||
docker update --restart unless-stopped $(docker ps -q)
|
||||
|
||||
Run command in bash:
|
||||
|
||||
docker exec -it <container> bash
|
||||
|
||||
|
||||
Reference in new issue
Block a user