devops-exercises/topics/containers/solutions/running_containers.md
abregman 99c4e02ecf Rename exercises dir
Name it instead "topics" so it won't be
strange if some topics included "exercises" directory.
2022-08-02 01:53:56 +03:00

1015 B

Running Containers

Objective

Learn how to run, stop and remove containers

Requirements

Make sure Podman or Docker (or any other containers engine) is installed on your system

Instructions

  1. Run a container using the latest nginx image - podman container run nginx:latest
  2. List the containers to make sure the container is running - podman container ls
  3. Run another container but this time use ubuntu latest and attach to the terminal of the container - podman container run -it ubuntu:latest /bin/bash
  4. List again the containers. How many containers are running? - podman container ls -> 2
  5. Stop the containers - WARNING: the following will stop all the containers on the host: podman stop $(podman container ls -q) or for each container podman stop [container id/name]
  6. Remove the containers - WARNING: the following will remove other containers as well if such are running: podman rm $(podman container ls -q -a) or for each container podman rm [container id/name]