Search This Blog

Saturday, 29 February 2020

Creating a custom image with podman



$ sudo podman login quary.io
Username:
Password:
Login Succeeded!


$ sudo podman run -d --name official-httpd -p 8180:80 ImageName

$ sudo podman ps 

#Log into the container 

$ sudo podman exec -it ImageName /bin/bash

# Updating a HTML page inside the container

bash-4.4# echo "Modified Page" > /var/www/html/home.html

exit
exit

$ curl 127.0.0.1:8180/home.html

Modified Page

# To see the modified changes on container
$ sudo podman diff ImageNmae

$ sudo podman stop ImageName
$ sudo podman ps
$ sudo podman commit -a 'pyla' IMAGENAME New-Custom-ImageName

$ sudo podman images 

REPOSITORY                             TAG         IMAGE ID
locahost/New-Custom-ImageName         latest      aa9b9426327

registry.access.redhat.com/ImageName   7.7        5gecfc91c83


$ sudo podman tag New-Custom-ImageName quay.io/pyla/New-Custom-ImageName:v1.0

$ sudo podman push quay.io/pyla/New-Custom-ImageName:v1.0

$ sudo podman run -d --name test -p 8280:80 pyla/New-Custom-ImageName:v1.0

$ sudo podman ps

$ sudo podman curl http://localhost:8280/home.html

Modified Page 

Get the container IP address:

$ sudo podman inspect \
> -f '{{ .NetworkSettings.IPAddress }}' ContainerName
10.xx.x.x



Ansible_Notes

   ansible -i inventory.ini -m ping all   # inventory.ini it will ping to the hosts which are in inventory # ansible -i inventory.ini -m pin...