Main Menu

Search

Showing posts with label podman config. Show all posts
Showing posts with label podman config. Show all posts

PODMAN: How To Configure Podman Container Instance As System Unit Service To Autorestart When the Host OS Reboots

Please find the steps below for enabling the podman container instance to auto restart when the OS is rebooted.

1) list the podman instances to get the container ID and name. 

podman ps -a

For e.g. below output

# podman ps -a
CONTAINER ID  IMAGE           COMMAND   CREATED        STATUS     PORTS       NAMES
45782651b66d  localhost/ock-ostree:latest nginx -g daemon o...  2 minutes ago  Up 2 minutes           0.0.0.0:8080->80/tcp    ock-content-server

2) Configure the podman container instance as service and enable the service. 

For this use below steps.

2(a) Create systemd file for podman container instances. In below command replace the name with container ID and os-tree-podman.service with the service name of choice.

podman generate systemd --new --name 9596fff2a7b1>/etc/systemd/system/ostree-podman.service

Above command will create a file /etc/systemd/system/ostree-podman.service

2(b) Restart the system daemon

systemctl daemon-reload

2(c) Enable the newly created podman container system unit file.

systemctl enable ostree-podman.service

2(d) List the system unit files 

systemctl list-unit-files | grep -i podman

You should see the newly created podman container system unit file and it should be enabled. For e.g. below output

# systemctl list-unit-files | grep -i podman
ostree-podman.service  enabled  


3) Reboot the host and  validate that the podman container instances is auto restarted.

For veirfying this, run below command.

podman ps -a


Keywords

Configuring setting up setup autorestart auto-restart service unit files files containers instances operating system rebooting reboots reboot restart restarting restarts os

PODMAN: How to Setup Podman Registry Instance Running On Non SSL HTTP protocol?

Following are steps to Setup Podman Registry Instance Running On Non SSL HTTP protocol?

1) Install podman (if its not already installed).

dnf -y install podman

2) Run podman instance by pulling container image. In this case we are pulling registry image from Oracle Container registry (OCR)

sudo podman run -d --name ock-registry \
-p 5000:5000 \
-v /var/lib/registry:/var/lib/registry:Z \
--restart=always \
-e REGISTRY_AUTH="" \
container-registry.oracle.com/os/registry:v2.7.1.1

3) Validate that the podman instance is running and podman registry image is pulled. 

For this use below commands.

podman ps -a

podman images


Below is sample outputs of above commands.

CONTAINER ID  IMAGE                                               COMMAND               CREATED        STATUS        PORTS                   NAMES
5cd3575b4a36  container-registry.oracle.com/os/registry:v2.7.1.1  serve /etc/docker...  5 seconds ago  Up 5 seconds  0.0.0.0:5000->5000/tcp  ock-registry

podman images
REPOSITORY                                 TAG         IMAGE ID      CREATED      SIZE
container-registry.oracle.com/os/registry  v2.7.1.1    695bdaead1f4  6 years ago  490 MB
 
4) For connecting from the clients to private registry running on HTTP, set insecure registry.

For this follow below steps.

Edit /etc/containers/registries.conf file and insert the following text at the end of the file.

[[registry]]
location = "localhost:5000"
insecure = true

Reload daemon and restart podman service after the change.

systemctl daemon-reload
systemctl restart podman



Keywords

registry registries private offline air-gapped airgapped air gapped install installation installing setup setting up configure configuring configuration 

PODMAN: How To Change /var/tmp (imageCopyTmpDir ) Of Podman To Different Directory?

Below are steps to change the podman tmp directory from default /var/tmp location.


1. Set the podman tmp directory to desired directory. In below command example it is /var/tmp/testdir. Change the /var/tmp/testdir directory to directory of your choice.

$ export TMPDIR=/var/tmp/testdir

2. Restart podman and reload daemon.

Below are commands.

$ sudo systemctl daemon-reload

$ sudo systemctl restart podman

3. Validate podman tmp directory is changed to the new directory set.

Use below command.

$ podman info | grep -i tmp

Below is the output you should see which should change the tmp directory location for imageCopyTmpDir parameter

$ podman info | grep -i tmp

  imageCopyTmpDir: /var/tmp/testdir 



Keywords:

Change Changing Update Updating default custom tmp temp temporary directories directories files file modify modifying cache caching