Docker installation and creating a user and directories
Installing Docker and Docker Compose on Ubuntu 22.04
Before working with Docker, you need to install Docker and Docker Compose themselves. Here's how to do it:
# Update package list and install required dependenciessudoaptupdatesudoaptinstallapt-transport-httpsca-certificatescurlsoftware-properties-common# Add the GPG key for Docker's official repositorycurl-fsSLhttps://download.docker.com/linux/ubuntu/gpg|sudoapt-keyadd-# Add Docker's repository to the APT sources listsudoadd-apt-repository"deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release-cs) stable"# Install Docker CEsudoaptupdatesudoaptinstalldocker-ce# Install Docker Composesudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudochmod+x/usr/local/bin/docker-compose# Verify Docker Compose versionsudodocker-compose--version
Creating a user and directories on the host system
Before creating the container on the host machine, it's necessary to create a user and group with limited permissions, as well as a folder for storing configuration settings and call recordings
# Creating a new user (e.g., www-user) without superuser rightssudoadduser--disabled-password--gecos""www-user# Creating directories for data storagesudomkdir-p/var/spool/mikopbx/cfsudomkdir-p/var/spool/mikopbx/storage# Granting the created user ownership of the directoriessudochown-Rwww-user:www-user/var/spool/mikopbx/