The ea-podman Script
Last modified: August 27, 2024
Overview
Use the /usr/local/cpanel/scripts/ea-podman
script to manage your containers in EasyApache 4.
Requirements
To run use this script, you must first have set up EasyApache 4 containers. This is because each application and package you install with the ea-podman
script creates a new container located in the ~/ea-podman.d/container-name
directory of the user’s home
directory. This directory holds the container’s information, files, and other data.
Run the script
To run this script, log in with SSH as the cPanel user or use the machinectl
command as the root
user to switch to a cPanel account.
To run this script on the command line, use the following format:
/usr/local/cpanel/scripts/ea-podman [command] [options]
- You cannot use the
su -
orsudo -E
commands to run this script. - This script’s available options change depending on which subcommands you use. For more information, read the Options section below.
- Your process identifiers (
pid
) will be public unless you set your/proc
tohidepid=2
. For more information about how to do this, read Red Hat’s How to Hide PID Listings from Non-Root Users in Linux documentation. Theea-podman
script will display an error message if this issue exists on your system.
Options
This script accepts the following commands, where package
represents the name of a container package:
View available containers
To view available containers, run the following command:
/usr/local/cpanel/scripts/ea-podman [command]
Command | Description | Example |
---|---|---|
avail |
List the available EasyApache 4 container-based packages and their installation status. When you install a container-based package, the ea-podman script creates a new container for it at the ~/ea-podman.d/container-name directory in the user’s home directory. |
avail |
registered [--all] |
List the user’s registered containers. If the root user uses the --all flag, this commands shows all containers on the system. |
registered |
running |
Show all running containers. | running |
Install an EA4 container-based package
Use this command to install an EA4 container-based application package.
/usr/local/cpanel/scripts/ea-podman install [package] [options]
Install a third-party container-based package
Use this command to install an container-based application package from a third-party image, such as Dockerhub.
When using third-party images, we strongly recommend the following precautions:
- Only use a trusted registry.
- Only use images that are either official or verified by the publisher.
- Specify a version tag to ensure that major or minor update changes will not affect your container.
In the following command, application-name
represents the name you want to use for your container, while image
represents the path to the application package.
/usr/local/cpanel/scripts/ea-podman install [application-name] [options] [image]
You may use the following options to customize your installation of a container-based application package from a third-party image:
Option | Description | Example |
---|---|---|
-v |
A volume to mount. | ea-podman install mymongo -v $HOME/myetcmongo:/etc/mongo |
--cpuser-port |
Set a port number for inside the container.
Note:
The system will set a port for the container itself. This option sets the port used inside the container.
|
ea-podman install mymongo --cpuser-port=8081 docker.io/library/mongo:latest |
--i-understand-the-risks-do-it-anyway |
Confirm that you want to install the package. | ea-podman install mymongo -v $HOME:/home/user docker.io/library/mongo:latest --i-understand-the-risks-do-it-anyway |
Set an environmental variable during installation
You may use the following option to customize your installation of any container-based application package:
Option | Description | Example |
---|---|---|
-e |
An environmental variable. | install ea-tomcat101 -e sample-variable=42 |
Uninstall a container
To uninstall a container, run the following command:
/usr/local/cpanel/scripts/ea-podman uninstall [container-name]
This will remove the container and the application inside it.
In the following table, container-name
represents the name of the container-based application, as shown with the registered
or running
options.
Command | Description | Example |
---|---|---|
uninstall [container-name] |
Uninstall a container-based application. | uninstall container.cptest1.01 |
Manage your container applications
In the following table, container-name
represents the name of a container, as shown with the registered
or running
options, while backup-file
represents the name of a backup file.
Use the following commands to manage your containers:
Command | Description | Example |
---|---|---|
backup |
Back up all containers.
Warning:
You cannot use this option to restore backups created by WHM’s Transfer Tool interface (WHM » Home » Transfers » Transfer Tool) or the
/usr/local/cpanel/scripts/restorepkg script .
ea-podman-backups directory of the user’s home directory. |
backup |
bash [container-name] [command] |
Open a bash shell for the named container and optionally run a command. |
bash example.cptest1.01 ls |
remove_containers [package] |
Remove all containers.
Warning:
This is a destructive action. We strongly recommend that you use the
uninstall command instead.
|
remove_containers ea-tomcat100 |
restart [container-name] |
Restart the named container. | restart example.cptest1.01 |
restore [backup-file] |
Restore a container from a backup file. | restore ea-podman-backups/backup.20220421193100.tar.gz |
start [container-name] |
Start a stopped container. | start example.cptest1.01 |
status [container-name] |
Display the status of a container. | status example.cptest1.01 |
stop [container-name] |
Stop a running container. | stop example.cptest1.01 |
subids [--ensure] |
Display a list of users with their subids. | subids |
upgrade [container-name] |
Upgrade a single container. | upgrade example.cptest1.01 |
upgrade_containers [package] [--all] |
Upgrade the installed containers.
Note:
You can use either the package name or the
--all option, but not both.
|
upgrade_containers tomcat |