Tuesday, March 12, 2019

Using podman in lieu of docker



--

In 2015, Docker, Red Hat, CoreOS, SUSE, Google, and other leaders in the Linux containers industry created the Open Container Initiative in order to provide an independent body to manage the standard specifications for defining container images and the runtime. In order to maintain that independence, the containers/image and containers/storage projects were created on GitHub.


https://github.com/containers/image

  image is a set of Go libraries aimed at working in various way with containers' images and container image registries.

https://github.com/containers/storage

  storage is a Go library which aims to provide methods for storing filesystem layers, container images, and containers. A containers-storage CLI wrapper is also included for manual and scripting use.

--

podman == docker

// To pull the image
podman pull fedora

image gets stored in ~/.local/share/containers/

--

Podman will default to searching through registries listed in the registries.conf file

--

// To run the image
podman run -it fedora bash

// check in another terminal
podman ps

// check the images
podman images

podman push fedora docker-daemon:fedora:latest

leaving out docker-daemon above, will push to docker hub. (which will error out).

To pull from docker's to podman

# podman pull docker-daemon:fedora:latest
--
podman useful in k8s environment:

 podman generate kube --help

NAME:

   podman generate kube - Generate Kubernetes pod YAML for a container or pod



USAGE:

   podman generate kube [command options] CONTAINER|POD-NAME



DESCRIPTION:

   Generate Kubernetes Pod YAML



OPTIONS:

   --service, -s  generate YAML for kubernetes service object

--



podman pod

NAME:

   podman pod - Manage container pods.



Pods are a group of one or more containers sharing the same network, pid and ipc namespaces.





USAGE:

   podman pod command [command options] [arguments...]



COMMANDS:

     create        Create a new empty pod

     exists        Check if a pod exists in local storage

     inspect       displays a pod configuration

     kill          Send the specified signal or SIGKILL to containers in pod

     pause         Pause one or more pods

     ps, ls, list  List pods

     restart       Restart one or more pods

     rm            Remove one or more pods

     start         Start one or more pods

     stats         Display percentage of CPU, memory, network I/O, block I/O and PIDs for containers in one or more pods

     stop          Stop one or more pods

     top           Display the running processes of containers in a pod

     unpause       Unpause one or more pods



OPTIONS:

   --help, -h  show help

--

podman build  - can build images over Dockerfile

--

Buildah can be described as a superset of commands related to creating and managing container images and, therefore, it has much finer-grained control over images. Podman’s buildcommand contains a subset of the Buildah functionality. It uses the same code as Buildah for building.

--

The most powerful way to use Buildah is to write Bash scripts for creating your images—in a similar way that you would write a Dockerfile.
--

K8s moved to CRI-O based on OCI runtime, no need for docker daemon.

no need to install docker on any host in k8s cluster.

k8s could call CRI-O and it could call runC directly.

--

buildah


  • much finer control over creating image layers.

Buildah run is not same as podman run command.

buildah run is for running specific commands in order to help build a container image

buildah run dnf -y install nginx

k8s solved runtime issue with CRI-O and runC

build problem with Buildah.

But, Docker still required. why? Debugging.

In order to avoid to install docker , use podman .

podman solves two problems -


  • operator to examine container and images with commands they are familiar with.



  • developers the same tools.




So, docker user, developer, operator all can make use of podman.

--

Source:
https://developers.redhat.com/blog/2019/02/21/podman-and-buildah-for-docker-users/


No comments:

Post a Comment