Update Docker Package Database. In a terminal window, type:
sudo yum check-update
Remove if any docker is preinstalled with your OS-
sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-selinux docker-engine-selinux docker-engine
Install the Dependencies
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
The –y switch indicates to the yum installer to answer “yes” to any prompts that may come up. The yum-utils switch adds the yum-config-manager. Docker uses a device mapper storage driver, and the device-mapper-persistent-data and lvm2 packages are required for it to run correctly.
Add the Docker Repository to CentOS
To install the edge or test versions of Docker, you need to add the Docker CE stable repository to your system. To do so, run the command:
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
A stable release is tested more thoroughly and has a slower update cycle. On the other hand, Edge release updates are more frequent but aren’t subject to as many stability tests.
Note: If you’re only going to use the stable release, don’t enable these extra repositories. The Docker installation process defaults to the latest version of Docker unless you specify otherwise. Leaving the stable repository enabled makes sure that you aren’t accidentally updating from a stable release to an edge release.
Install Docker On CentOS Using Yum
With everything set, you can finally move on to installing Docker on CentOS 7 by running:
sudo yum install docker-ce docker-compose
The system should begin the installation. Once it finishes, it will notify you the installation is complete and which version of Docker is now running on your system.
Manage Docker Service
Although you have installed Docker on CentOS, the service is still not running. To start the service, enable it to run at startup. Run the following commands in the order listed below.
Start Docker:
sudo systemctl start docker
Enable Docker:
sudo systemctl enable docker
Check the status of the service with:
sudo systemctl status docker
Now you have a docker up and running!
phpIPAM setup using Docker Compose
Using Docker Compose, you can use the following example code to configure phpIPAM and the required MySQL container.
I’ll be putting it up at /opt
cd /opt nano docker-compose.yml
Paste the below texts into the yml file- save and exit
version: '3' services: phpipam-web: image: phpipam/phpipam-www:latest ports: - "80:80" environment: - TZ=America/Chicago - IPAM_DATABASE_HOST=phpipam-mariadb - IPAM_DATABASE_PASS=password - IPAM_DATABASE_WEBHOST=% restart: always volumes: - phpipam-logo:/phpipam/css/images/logo - phpipam-ca:/usr/local/share/ca-certificates:ro depends_on: - phpipam-mariadb phpipam-cron: image: phpipam/phpipam-cron:latest environment: - TZ=Europe/London - IPAM_DATABASE_HOST=phpipam-mariadb - IPAM_DATABASE_PASS=password - SCAN_INTERVAL=1h restart: always volumes: - phpipam-ca:/usr/local/share/ca-certificates:ro depends_on: - phpipam-mariadb phpipam-mariadb: image: mariadb:latest environment: - MYSQL_ROOT_PASSWORD=password restart: always volumes: - phpipam-db-data:/var/lib/mysql volumes: phpipam-db-data: phpipam-logo: phpipam-ca:
Replace your_root_password and your_phpipam_password with your desired passwords for the MySQL root user and the phpIPAM user, respectively.
Save this YAML code as docker-compose.yml in a directory of your choice. To spin up the containers, open a terminal, navigate to the directory containing the docker-compose.yml file, and run the following command:
docker compose up -d
This command will create and start both the MySQL and phpIPAM containers, linking them as specified in the docker-compose.yml file.
Configuring phpIPAM
Once you have deployed the phpIPAM container, you can start configuring the IP address management application through the web UI.
Setting Up the MySQL Database
Access the phpIPAM web UI and enter your connection information. Note that the MySQL database, MySQL user, and MySQL password should match the ones you used when creating the MySQL instance. Next, provide the admin user password for the phpIPAM application. Note the following screens during the web-based setup process.
Ref:
https://www.virtualizationhowto.com/2023/04/mastering-phpipam-docker-the-ultimate-setup-guide/