# Podman maybe a Docker alternative?

![podman.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1668883219917/EbpeYeSgJ.png align="left")

### What is Podman?

**Podman is a container management tool that offers similar features to Docker for managing containers.**

**One of the best features of Podman is its ability to run rootless containers. A rootless container is a concept of running and managing containers without root privileges. From a security standpoint, rootless containers add a layer of security by not allowing root access even if the container gets compromised by an attacker.**

**Podman also comes with a unique feature that Docker lacks entirely namely "pods". In podman, containers can form “pods” that operate together. The "pod" concept lets you manage multiple containers combined. You can create separate containers for a single app, for instance, a frontend, a backend, and a database container, then add them to a pod, and manage them integrally.**

more info and download: [getting-started](https://podman.io/getting-started/installation)

macOS homebrew: `brew install Podman`  
After installation is finished, in your terminal: `podman version`

### To run Podman

initialize Podman: `podman machine init --cpus 4 --disk-size 50 --memory 4096`  
start Podman: `podman machine start`

### Testing the Podman installation

Clone Alpine Nginx from GitHub:

```plaintext
git clone https://github.com/RobertoTorino/podman-sample.git && cd podman-sample/alpine_nginx
```

Create Podman image:

```plaintext
podman build --format docker --tag alpine_nginx .
```

When the process is finished create a Podman container:

```plaintext
podman run -dt -p 9999:80 alpine_nginx
```

Check running containers:

```plaintext
podman ps -a
```

Test the connection, this should return a response:

```plaintext
curl http://localhost:9999
```

Test localhost in your browser, this should return a response, paste this in your browser:

```plaintext
http://localhost:9999/
```

When you receive this error message:

```plaintext
level=warning msg= "< SOME_MESSAGE_HERE > is not supported for OCI image format and will be ignored. Must use `docker` format"
```

Then use this in your build command:

```plaintext
--format docker
example: podman build --format docker --tag alpine_nginx .
```

### For more info to get started with Podman

Check this: [getting-started](https://podman.io/getting-started/installation)  
Pods explained: [click here](https://developers.redhat.com/blog/2019/01/15/podman-managing-containers-pods#create_a_pod)

Podman on Github: [GitHub](https://github.com/containers/podman)

### Podman and Docker

**Both Podman and Docker comply with the OCI container standard, Podman can also build containers from a Dockerfile. If you can build and run a container from a Dockerfile with Docker, then you can run it with Podman as well.**

### What is Podman desktop?

**Podman Desktop enables you to easily work with containers from your local environment and installs, configures and keeps Podman up to date. It provides a system tray, to check status and interact with your container engine, images, pods and volumes. Podman Desktop also provides capabilities to connect and deploy pods to Kubernetes environments and is compatible with docker.**

![podman-desktop-III.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1668884910650/aTn-Vy9dr.png align="left")

More info and download: [podman-desktop](https://podman-desktop.io/)

macOS homebrew:

```plaintext
brew install podman-desktop
```

### For more info to get started with Podman desktop

Check this: [podman-desktop](https://podman-desktop.io/docs/intro) and podman-desktop on Github: [GitHub](https://github.com/containers/podman-desktop)

**Some useful commands when starting with Podman:**

```plaintext
podman search [image-name]
podman pull [image-name]
podman run [image-name]	
podman stop [container-id]	
podman rm [container-id]	
podman rmi [image-name]	
podman images	
podman info	
podman image prune -a	
podman system prune	
podman kill $(podman ps -q )
```
