[root@host /]# podman run -p 80:80 -p 443:443 -it --name apache --hostname apache apache-test /usr/bin/bash
[root@apache /]# scl enable httpd24 /bin/bash
[root@apache /]# which httpd
/opt/rh/httpd24/root/usr/sbin/httpd
[root@apache /]# httpd -DFOREGROUND
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 10.88.0.9. Set the 'ServerName' directive globally to suppress this message
Make a note of that IP address 10.88.0.9. (We may or may not need this.)
Create a new terminal window to deal with php-fpm: type "Ctrl-b" then "c". Then, run php-fpm
[root@apache /]# scl enable rh-php73 /bin/bash
[root@apache /]# mkdir /run/php-fpm
[root@apache /]# php-fpm --nodaemonize
[22-Jun-2020 20:08:10] NOTICE: fpm is running, pid 120
[22-Jun-2020 20:08:10] NOTICE: ready to handle connections
[22-Jun-2020 20:08:10] NOTICE: systemd monitor interval set to 10000ms
XXX
To configure an entrypoint which runs more than one executable, we can to write a wrapper script. In our case, we need to run httpd and php-fpm. (
Docker example of a wrapper script.) Note that this is not the recommended way of doing things, which would be to have separate containers for httpd and php-fpm.
/opt/rh/httpd24/root/usr/sbin/httpd
/opt/rh/rh-php73/root/usr/sbin/php-fpm
Configure entrypoints to run httpd24 and php-fpm:
[root@urcfstora tmp]# buildah config --entrypoint '["scl enable httpd24 /usr/sbin/httpd -DFOREGROUND", "scl enable rh-php73 php-fpm --nodaemonize"]' $container
Run:
[root@urcfstora tmp]# podman run -p 80:80 -p 443:443 --name apache --hostname apache --detach apache-test
708bece1d46225f8628a680516df00ce66921673df4e1cc50f2953053f04af70
[root@urcfstora tmp]# podman ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
708bece1d462 localhost/apache-test:latest /bin/bash 4 seconds ago Exited (0) 3 seconds ago 0.0.0.0:80->80/tcp apache
8651efee175f localhost/postgres-test:latest su - postgres -c ... 2 weeks ago Up 2 weeks ago 0.0.0.0:5432->5432/tcp psql
Open a new terminal on the host machine to examine the running containers:
[root@host ~]# podman ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e1b1270c4745 localhost/apache-test:latest /usr/bin/bash 25 minutes ago Up 25 minutes ago 0.0.0.0:80->80/tcp apache
8651efee175f localhost/postgres-test:latest su - postgres -c ... About an hour ago Up About an hour ago 0.0.0.0:5432->5432/tcp psql
Try to connect to the web server (unencrypted). Launch a web browser on another machine (your PC, or something not the host machine), and connect to the host machine (ignoring the self-signed certificate errors):
https://host.acmecorp.com
podman will have automatically opened ports in the firewall.
For the MediaWiki container to connect to the PostgreSQL container, the PostgreSQL container's IP address needs to be known. Find it by doing:
[root@host]# podman inspect psql | egrep "10\."
"Gateway": "10.88.0.1",
"IPAddress": "10.88.0.8",
So, the "psql" container's IP is 10.88.0.8. We will need this address for the Mediawiki setup in the next step. Also, leave the port (5432) the same.
Now, fire up a web browser on your host, and browse itself. The httpd running in the container will respond, since we ran it mapping the appropriate http/https ports to the host ports:
https://host.acemcorp.com/testwiki/
Follow the prompts to setup the wiki. Recall the wiki db name, db user name, and the password set up above.
At the end of that, you will be able to download the LocalSettings.php file, which you will then copy to the "apache" container.
Next, we mount the "apache" container, and copy MediaWiki's LocalSettings.php file to it:
[root@host]# apachemnt=$(podman mount apache)
[root@host]# cp /location/of/LocalSettings.php $apachemnt/opt/rh/httpd24/root/var/www/html/testwiki
Then, in your browser, click on that "enter your wiki" link. You should see something like this:
Test that you can create a new article:
PERFORMANCE CO-PILOT
Unfortunately, RHEL7 does not seem to provide PCP for Podman.
DELETE CONTAINERS
When containers are not running, they may be deleted. First, get their container IDs, and then delete them:
If you don't want the images that you built to hang around in your local storage, you can remove them. The "-f" option will also remove containers which use those images. (Use "buildah images" to see what images are in local storage.)