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:
- Build a database server image using a container or docker file
- Import a database server image from your local machine using the Import button on the Images component page
- Pull a database server image from a registry (covered in this tutorial)
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:
- Installed Podman Desktop.
- A running Podman machine.
- A developer role.
Pulling a PostgreSQL server image
- Click Images in the left navigation pane.
- Click the Pull button.
- Enter the name of the image to pull from the registry.
- Click Pull image. A download complete notification opens.
- Click Done.
- View the newly created
quay.io/fedora/postgresql-16
image on the same page.
Creating a PostgreSQL server instance
-
Click Images in the left navigation pane.
-
Click the Run Image icon corresponding to the PostgreSQL server image you want to run.
-
Configure the basic details, such as container name, port mapping, and environment variables for the PostgreSQL server instance.
-
Click Start Container.
-
View the successful operation notification in the Tty tab of the Container Details page.
noteYou can also check the Logs tab for the same notification.
-
Click the close icon on the right hand side of the page.
-
Click Containers in the left navigation pane.
-
View the newly created PostgreSQL server container on the page.
Accessing the instance from terminal
-
Click Containers in the left navigation pane.
-
Click the created
postgresql-database
container. The Container Details page opens. -
Select the Terminal tab.
-
Run the
psql
command to connect to the database server. The prompt changes topostgres=#
. -
Interact with the database server by running any PostgreSQL commands, such as
\list
:
To access this database server instance from inside a running application container, use the podman exec -it postgresql-database /bin/bash
command.