Skip to content

Instantly share code, notes, and snippets.

Forked from jclaret/podman_examples
Created October 26, 2022 01:25
What would you like to do?
podman search rhel
podman pull rhel
podman images
podman run ubi7/ubi:7.7 echo "Hello!"
podman run -d rhscl/httpd-24-rhel7:2.4-36.8
podman run -it ubi7/ubi:7.7 /bin/bash
podman run -e GREET=Hello -e NAME=RedHat rhel7:7.5 printenv GREET NAME
podman run --name mysql-custom -e MYSQL_USER=redhat -e MYSQL_PASSWORD=r3dh4t -d rhmap47/mysql:5.5
podman run --name mysql-basic \
> -e MYSQL_USER=user -e MYSQL_PASSWORD=mypass \
> -e MYSQL_DATABASE=database -e MYSQL_ROOT_PASSWORD=mypass \
> -d rhscl/mysql-57-rhel7:5.7-3.14
podman ps --format "{{.ID}} {{.Image}} {{.Names}}"
podman exec -it mysql-basic /bin/bash
mysql -uroot
mysql> show databases;
use database;
mysql> CREATE TABLE Projects (id int(11) NOT NULL,
-> name varchar(255) DEFAULT NULL,
-> code varchar(255) DEFAULT NULL,
-> PRIMARY KEY (id));
mysql> show tables;
mysql> insert into Projects (id, name, code) values (1,'Mola','001');
mysql> select * from Projects;
mysql> exit
podman run -d -p 8080:80 --name httpd-basic httpd:2.4
curl http://localhost:8080
podman exec -it httpd-basic /bin/bash
podman run rhscl/httpd-24-rhel7
podman ps
podman run --name my-httpd-container rhscl/httpd-24-rhel7
podman run --name my-httpd-container -d rhscl/httpd-24-rhel7
podman run rhscl/httpd-24-rhel7 ls /tmp
podman run -it rhscl/httpd-24-rhel7 /bin/bash
podman exec 7ed6e671a600 cat /etc/hostname
podman exec my-httpd-container cat /etc/hostname
podman exec -l cat /etc/hostname
podman inspect my-httpd-container
podman inspect -f '{{ .NetworkSettings.IPAddress }}' my-httpd-container
podman stop my-httpd-container
podman kill my-httpd-container
podman kill -s SIGKILL my-httpd-container
podman restart my-httpd-container
podman rm my-httpd-container
podman rm -a
podman stop -a
podman logs mysql-db
podman ps -a --format="table {{.ID}} {{.Names}} {{.Status}}"
mkdir -pv /var/local/mysql
semanage fcontext -a -t container_file_t '/var/local/mysql(/.*)?'
restorecon -R /var/local/mysql
ls -dZ /var/local/mysql
chown -Rv 27:27 /var/local/mysql
podman pull rhscl/mysql-57-rhel7
podman run --name persist-db \
> -d -v /var/local/mysql:/var/lib/mysql/data \
> -e MYSQL_USER=user1 -e MYSQL_PASSWORD=password \
> rhscl/mysql-57-rhel7
podman ps --format="table {{.ID}} {{.Names}} {{.Status}}"
podman run -d --name apache3 -p rhscl/httpd-24-rhel7:2.4
podman port apache3
registries = ["", ""]
registries = ['localhost:5000']
curl -Ls https://myserver/v2/_catalog?n=3 | python -m json.tool
curl -Ls | python -m json.tool
podman login -u username -p password
curl -u username:password -Ls ""
curl -H "Authorization: Bearer -Ls | python -mjson.tool
podman pull
podman save -o mysql.tar
podman load -i mysql.tar
podman rm image
podman rmi -a
podman ps
podman diff mysql-basic
podman commit mysql-basic mysql-custom
podman tag mysql-custom devops/mysql
podman login
podman run -d --name official-httpd -p 8180:80 redhattraining/httpd-parent
podman exec -it official-httpd /bin/bash
podman inspect -f "{{range .Mounts}}{{println .Destination}}{{end}}" official-httpd
podman diff official-httpd
podman stop official-httpd
podman commit -a 'Your Name' official-httpd custom-httpd
podman images
# This is a comment
FROM ubi7/ubi:7.7
LABEL description="This is a custom httpd container image
RUN yum install -y httpd
ENV LogLevel "info"
ADD /var/www/html
COPY ./src/ /var/www/html/
USER apache
ENTRYPOINT ["/usr/sbin/httpd"]
vi Dockerfile
FROM ubi7/ubi:7.7
MAINTAINER Your Name <youremail>
LABEL description="A basic Apache container on RHEL 7 UBI"
RUN yum install -y httpd && \
yum clean all
RUN echo "Hello from Dockerfile" > /usr/share/httpd/noindex/index.html
podman build --layers=false -t example/apache .
podman images
podman run --name lab-apache -d -p 10080:80 do180/apache
podman ps
oc login
oc new-app \
> \
> --name=mysql-openshift \
> -e MYSQL_USER=user1 -e MYSQL_PASSWORD=passwd -e MYSQL_DATABASE=testdb \
oc status
oc get pods -o=wide
oc expose service mysql-openshift
oc port-forward mysql-openshift-1-glqrp 3306:3306
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment