Manage containers Flashcards

1
Q

how to search for container image from a specific registry

A

podman search –no-truncregistry.access.redhat.com/rhel8

–no-trunc gives more detailed information about the image

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

how to search for a container image

A

podman search rhel8

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

how to get the current container image from a specific repository

A

podman pull registry.access.redhat.com/ubi8/ubi:latest

registry_name/user_name/image_name:tag

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

where is the config file that podman uses to keep track of registries

A

/etc/containers/registries.conf

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

what command will display the current configuration for podman

A

podman info

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

how to inspect container image using podman

A

podman inspect registry.redhat.io/rhel8/python-36

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

how to inspect container image using skopeo

A

skopeo inspect docker://registry.redhat.io/rhel8/python-36

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

how to list all the container images on the system

A

podman images

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

how to remove a specific container image

A

podman rmi registry.redhat.io/rhel8/python-36:latest

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

how to view all current running containers

A

podman ps

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

how to view all containers that are either running or died

A

podman ps -a

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

how to remove a specific container

A

podman rm httpd-24

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

how to kill a running container

A

podman kill -s SIGKILL httpd-24

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

how to run a container image in the background with a specified name and port forwarding

A

podman run -d -p 8000:8080 –name=httpd-24 registry.redhat.io/rhel8/httpd-24

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

how to restart a container

A

podman restart httpd-24

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

how to stop a container

A

podman stophttpd-24

17
Q

how to get a bash shell in a running container

A

podman exec -it my_webserver /bin/bash

18
Q

how to attach persistent storage to a container

A

podman run -d –name mydb -v /home/user/dbfiles:/var/lib/mysql:Z registry.redhat.io/rhel8/mariadb:latest

-v /folder/file/location/on/system:/location/in/container:Z (Z automatically applies the SELinux container_file_t context type)

19
Q

how to configured a container to start on bootup running as a user (not root)

A

loginctl enable-linger
podman run -d –name web registry.redhat.io/rhel8/httpd-24:latest
podman generate systemd –name web –files –new
cp container-web.service ~/.config/systemd/user/
systemctl –user daemon-reload
systemctl –user enable myapp.service
systemctl –user start myapp.service

20
Q

how to configure a container to start on bootup (can be as root)

A

podman run -d –name web registry.redhat.io/rhel8/httpd-24:latest
podman generate systemd –name web –files –new
cp container-web.service /etc/systemd/system/
systemctl daemon-reload
systemctl enable myapp.service
systemctl start myapp.service

21
Q

how to start a container (not image)

A

podman start httpd-24