=====Manage Container Storage and Network Resources=====
You can use containers to run a simple process and exit.
You can also configure a container to run a service continuously, such as a database server. If you run a service continuously, you might eventually need to add more resources to the container, such as persistent storage or access to more networks.
When a container, such as a web server or database server, serves content for clients outside the container host, you must set up a communication channel for those clients to access the content of the container. You can configure port mapping to enable communication to a container. With port mapping, the requests that are destined for a port on the container host are forwarded to a port inside the container.
Directory that is mounted inside the container has tyo have **container_file_t** for selinux
forwarding ports uses the option -p for example
podman run -d --name web 8080:8080 quay.io/rdacosta/my_http:lattest
the first 8080 is from the host and it will be mapped to the second 8080 on the container
to use volume mounting you use -v option and similar consept first is local host location then its container address
for example
podman run -d --name web1 -p 8081:8080 -v /home/kiosk/web1:/var/www/html:Z quay.io/rdacosta/my_http:lattest
the capital Z ensure selinux context are correct
podman unshare chown 27:27 apps.db
podman run -d --name apps_db -p 13306:3306 -v /home/kiosk/apps_db:/var/lib/mysql/data:Z -e USER=ricardo \
-e MYSQL_PASSWORD=redhat123 \
-e MYSQL_DATABASE=apps \
-e MYSQL_ROOT_PASSWORD=redhat321 \
quay.io/rdacosta/my_http:lattest
^ -p | does port forwarding |
^ -v | does volume forwarding |
^ Z | set selinux context for container |
^ -e | specifying container variable |