diff --git a/src/rhcsa.md b/src/rhcsa.md index 28a4ecf..9a0fae6 100644 --- a/src/rhcsa.md +++ b/src/rhcsa.md @@ -959,9 +959,43 @@ podman ps # Display the running containers podman logs mynginx # Display the logs of the mynginx container podman exec -it mynginx bash # Execute a command in the mynginx container -podman stop mynginx # Stop the mynginx container podman start mynginx # Start the mynginx container +podman stop mynginx # Stop the mynginx container podman rm mynginx # Remove the mynginx container podman rmi nginx:latest # Remove the nginx image +``` + +### Building Custom Images with Podman +```bash +FROM fedora:latest + +RUN dnf install -y vim + +COPY welcome.txt /root/welcome.txt + +CMD ["/bin/bash"] +``` + +> Note: You can build the image with podman build -t myimage . + +### Running Containers with Podman +```bash +### build the image +podman build -t myimage -f Containerfile . + +### run the container +podman run -it --name mycustomcontainer myimage +``` + +### Persistent Storage +```bash +### create a volume +podman volume create myvolume + +### list the volumes +podman volume ls + +### run the container with the volume +podman run --name mywebserver -d -p 8080:80 -v myvolume:/var/www/html:Z nginx ``` \ No newline at end of file