Skip to main content

Interacting with a database server

This tutorial covers the following end-to-end tasks required to interact with a database server from within the Podman Desktop UI:

  • Pulling a database server image
  • Creating a database server instance
  • Accessing the instance from terminal

For creating a database instance, you can use one of the following options:

This tutorial focuses on creating a PostgreSQL server instance by pulling the quay.io/fedora/postgresql-16 image from the quay.io registry.

Before you begin

Make sure you have:

Pulling a PostgreSQL server image

  1. Click Images in the left navigation pane.
  2. Click the Pull button. pulling an image
  3. Enter the name of the image to pull from the registry.
  4. Click Pull image. A download complete notification opens. clicking the pull button
  5. Click Done. image pulled successfully
  6. View the newly created quay.io/fedora/postgresql-16 image on the same page. image added on the page

Creating a PostgreSQL server instance

  1. Click Images in the left navigation pane.

  2. Click the Run Image icon corresponding to the PostgreSQL server image you want to run. running an image

  3. Configure the basic details, such as container name, port mapping, and environment variables for the PostgreSQL server instance.

  4. Click Start Container. starting a container

  5. View the successful operation notification in the Tty tab of the Container Details page. sql server started

    note

    You can also check the Logs tab for the same notification.

  6. Click the close icon on the right hand side of the page.

  7. Click Containers in the left navigation pane.

  8. View the newly created PostgreSQL server container on the page. database container created

Accessing the instance from terminal

  1. Click Containers in the left navigation pane.

  2. Click the created postgresql-database container. The Container Details page opens. database container

  3. Select the Terminal tab.

  4. Run the psql command to connect to the database server. The prompt changes to postgres=#. connect to the PostgreSQL server instance

  5. Interact with the database server by running any PostgreSQL commands, such as \list: interact with the database

note

To access this database server instance from inside a running application container, use the podman exec -it postgresql-database /bin/bash command.