Description
A validation test case for Podman on Fedora IoT Edition that tests creating, running, checkpointing, stopping, and removing a container as well as container logs.
Setup
This testcase can be run on either an image or installation, on hardware or in virtualization.
How to test
Boot image or Installation and log in locally or SSH into booted image.
Check if podman is installed
rpm -q podman
Check to see if you can pull an image from the registry
podman pull registry.fedoraproject.org/fedora:latest
Run hello-world to test.
podman run -it registry.fedoraproject.org/fedora:latest echo Hello-World
Create and Run a Container
Use the following Containerfile to set this container up:
cat << EOF >> Containerfile FROM registry.fedoraproject.org/fedora:latest RUN /usr/bin/dnf install -y httpd EXPOSE 80 CMD ["-D", "FOREGROUND"] ENTRYPOINT ["/usr/sbin/httpd"] EOF
Build an image:
sudo podman build -t fedora-httpd $(pwd)
Verify the image:
sudo podman images
Run the container:
sudo podman run -d -p 1080:80 localhost/fedora-httpd
List the running container and take note of the CONTAINER ID:
sudo podman ps
Test that apache is working, this should display the httpd default test page html:
curl http://localhost:1080
Open the firewall to accept connections on port 80 and forward to port 1080:
sudo firewall-cmd --add-forward-port=port=80:proto=tcp:toport=1080 --permanent sudo firewall-cmd --reload
Open a web browser on another computer and enter the IP address to test the page is visible.
Checkpointing/Restoring
Checkpoint the container using the CONTAINER ID from the previous sudo podman ps
command:
sudo podman container checkpoint <container_id>
Check that the httpd server is no longer running now that the container has been checkpointed:
curl http://localhost:1080
Restore the checkpointed container to it's running state:
sudo podman container restore <container_id>
Now that the container has been restored, check that the httpd server is running again:
curl http://localhost:1080
Container Inspection/Logs
Inspect the container to ensure it's running:
sudo podman inspect <container_id> | grep Status
Check that a log message about the "server's fully qualified domain name" is shown:
sudo podman logs <container_id>
Stopping/Removing
Using the CONTAINER ID, stop the container:
sudo podman stop <container_id>
Ensure the container shows STATUS: Exited
:
sudo podman ps -a
Remove the container:
sudo podman rm <container_id>
The container should no longer show in the list:
sudo podman ps -a
Results
- Latest image pulled successfully from the Registry
- podman is installed
- Hello World is displayed
- Custom container created, httpd test page visible on a browser or using curl.
- Container is checkpointed and restored
- Log message is shown
- Container stops and is removed