1015 B
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
- Run a container using the latest nginx image -
podman container run nginx:latest
- List the containers to make sure the container is running -
podman container ls
- 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
- List again the containers. How many containers are running? -
podman container ls
-> 2 - Stop the containers - WARNING: the following will stop all the containers on the host:
podman stop $(podman container ls -q)
or for each containerpodman stop [container id/name]
- 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 containerpodman rm [container id/name]