How to manage containers in linux?

Here are the 50 practical scenarios on how to manage containers in linux that can help you prepare for the RHSA (Red Hat Certified System Administrator) exam:

Container Basics:

1. Install Docker or Podman on a system.

2. Verify the installation and version of Docker/Podman.

3. Start the Docker/Podman service and enable it to start at boot.

4. Check the status of the container runtime service.

5. Search for an official Docker image on Docker Hub or a Podman image on Quay.io.

6. Pull a specific version of an image from a container registry.

7. List locally available container images.

8. Remove a container image from the local system.

Container Management:

9. Run a container with a specific name and specified ports.

10. Start, stop, and restart a running container.

11. Execute a command inside a running container.

12. View the logs of a running container.

13. Attach to a running container’s shell.

14. Remove a stopped container.

15. Create a Dockerfile or Podmanfile to define a custom container image.

16. Build a custom container image from a Dockerfile/Podmanfile.

17. Push a custom container image to a container registry.

Container Networking:

18. Create a custom Docker bridge network.

19. Run a container within a custom bridge network.

20. Inspect the network settings of a running container.

21. Publish container ports to specific host ports.

22. Create a custom Podman network namespace.

23. Attach a running container to a custom network.

24. Expose a container’s ports using network namespaces.

Storage and Volumes:

25. Create a Docker volume to persist container data.

26. Mount a host directory as a volume in a container.

27. View a list of Docker volumes on the system.

28. Remove a Docker volume.

29. Mount a named volume in a Podman container.

30. Copy files between the host and a mounted volume.

31. Backup and restore data from a named volume.

Container Security:

32. Check for available security updates for container images.

33. Scan a container image for vulnerabilities using a tool like Trivy or Clair.

34. Configure Podman to run containers with a specific user.

35. Implement resource limits (CPU, memory) for a container.

36. Apply SELinux labels to a container.

Container Orchestration:

37. Install and configure Docker Compose (Docker) or Podman Compose (Podman).

38. Create a Docker Compose or Podman Compose file to define a multi-container application.

39. Deploy a multi-container application using Compose.

40. Scale the number of containers in a Compose application.

41. Update and redeploy a Compose application.

Container Registry:

42. Set up a local container registry using Docker Distribution or Podman’s built-in registry.

43. Push a custom container image to a local registry.

44. Configure Docker or Podman to use a custom registry.

45. Pull an image from a custom registry.

46. Secure a container registry using TLS certificates.

Container Troubleshooting:

47. Identify and resolve common container-related issues, such as port conflicts or resource constraints.

48. Check container logs for error messages.

49. Inspect a container’s metadata and settings.

50. Troubleshoot network connectivity problems within a container.

Note :These scenarios cover a wide range of container-related tasks and concepts, which are essential for managing containers in a Linux environment. Practice these tasks with Docker or Podman on a Red Hat-based system to prepare for the RHSA exam and real-world container management challenges.