101Docker - amagerard/Docker GitHub Wiki

RedHat/Docker.

1- Docker 2- Firewall 3- Portainer 4- Drupal 5- Joomla
6-Wordpress 7-Xwiki 8- Mediawiki
Casaos Zimaos

1. Docker.

Docker is a set of platform as a service (PaaS) products that use OS-level virtualization
to deliver software in packages called containers (Wikipedia].
For a Linux user, this is similar to an advanced chroot.

1.1 Prerequisites.

The VM Docker is a TemplateVM clone.
See the installation of TemplateVM.
Server with GUI is installed (dnf groupinstall "Server with GUI").
The status of selinux is permissive.
vi /etc/crontab

@reboot root setenforce 0  

Reboot the server to apply.

1.2 Network configuration.

This procedure is based on this example.

Docker server ip :192.168.60.55/24
Your username: teacher
Your home directory:/home/teacher

1.2.1 Change the name of the VM.

Modify or create the following files.
vi /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4  
192.168.60.55  docker.ol26modk.com  docker  

vi /etc/hostname

docker  

vi /etc/sysconfig/network

# Created by anaconda  
networking=yes  
HOSTNAME=docker.ol26modk.com  

1.2.2 Change network in static mode.

Example:
IP: 192.168.60.55/24
Gateway: 192.168.60.254
Name Server: 192.168.90.41
Search domain: ol26modk.com

nmcli con mod eth0 ipv4.method "manual" ipv4.addresses 192.168.60.55/24
nmcli con mod eth0 ipv4.gateway 192.168.60.254
nmcli con mod eth0 ipv4.dns 192.168.90.41
nmcli con mod eth0 ipv4.dns-search ol26modk.com

To read the configuration of the eth0 network.
more /etc/NetworkManager/system-connections/eth0.nmconnection

Apply the new network configuration.
ifconfig eth0 0.0.0.0
systemctl restart NetworkManager
ip a or ifconfig

Restart the Docker server.
reboot

1.3 Docker installation.

The operating system is Red Hat 9.5 Enterprise.
dnf -y install dnf-plugins-core
dnf config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo

dnf update
dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
systemctl start docker
systemctl enable docker

See the docker version.
docker --version

Docker version 27.3.1, build ce12230  

Add your user to the docker group.
usermod -aG docker teacher
id teacher

uid=1000(<username>) gid=1000( teacher) groupes=1000(teacher),980(docker)  

Docker gives default permissions on volumes gid 33 for html and gid 999 for mysql.
They are not the same gid for Red Hat.
To date, I have not found a solution.

I need a user and group without logging for permissions on volume.

Create a www-dock and mysql-dock user without home and nologin.
By default user UIDs and group GIDs are limited to 999.
vi /etc/login.defs
Modify the lines.

SYS_UID_MAX            2010  
SYS_GID_MAX            2010  

useradd --shell /usr/sbin/nologin --system --uid 2001 --user-group --no-create-home www-dock
useradd --shell /usr/sbin/nologin --system --uid 2002 --user-group --no-create-home mysql-dock

id www-dock

uid=2001(www-dock) gid=2001(www-dock) groupes=2001(www-dock)  

id mysql-dock

uid=2002(mysql-dock) gid=2002(mysql-dock) groupes=2002(mysql-dock)  

1.4 Expand the var partition.

Each Docker Instance takes 500m disc space on the var partition.
To expand the 4G disk space to 10G.
lvdisplay /dev/vgl0/var
lvextend -L+6G /dev/vgl0/var
resize2fs /dev/vgl0/var
lvdisplay /dev/vgl0/var

⚠️ **GitHub.com Fallback** ⚠️