How to Install postgresql-client 17 on Docker Alpine Using apk
Автор: vlogommentary
Загружено: 2025-12-28
Просмотров: 5
Learn how to properly install PostgreSQL client version 17 on an Alpine-based Docker image using apk repositories and handle common installation errors.
---
This video is based on the question https://stackoverflow.com/q/79346057/ asked by the user 'SexyMF' ( https://stackoverflow.com/u/936651/ ) and on the answer https://stackoverflow.com/a/79348519/ provided by the user 'Xu Ouyang' ( https://stackoverflow.com/u/21353113/ ) at 'Stack Overflow' website. Thanks to these great users and Stackexchange community for their contributions.
Visit these links for original content and any more details, such as alternate solutions, latest updates/developments on topic, comments, revision history etc. For example, the original title of the Question was: how to install postgresql-client 17 on docker alpine using apk
Also, Content (except music) licensed under CC BY-SA https://meta.stackexchange.com/help/l...
The original Question post is licensed under the 'CC BY-SA 4.0' ( https://creativecommons.org/licenses/... ) license, and the original Answer post is licensed under the 'CC BY-SA 4.0' ( https://creativecommons.org/licenses/... ) license.
If anything seems off to you, please feel free to drop me a comment under this video.
---
Introduction
When working with Docker images based on Alpine Linux, installing specific versions of packages like postgresql-client can be challenging due to package naming conventions and repository support. This guide addresses how to install postgresql-client version 17 on the mcr.microsoft.com/azure-cli:2.9.1 image, which is Alpine-based.
The Problem
Running the following commands in your Dockerfile:
[[See Video to Reveal this Text or Code Snippet]]
results in an error:
[[See Video to Reveal this Text or Code Snippet]]
This happens because the postgresql-client17 package is not available in the default Alpine repositories configured in the image.
Why the Error Occurs
The Alpine version in the base image may not have the desired PostgreSQL client version in its stable repository.
Package naming for PostgreSQL clients on Alpine often follows postgresql17-client rather than postgresql-client17.
Required packages may reside in the Alpine edge (testing) repository, not enabled by default.
The Solution
Step 1: Use the Edge Main Repository
Add the Alpine edge main repository to your APK repositories to access newer or testing packages such as postgresql17-client.
[[See Video to Reveal this Text or Code Snippet]]
Step 2: Update and Upgrade
Run update and upgrade with the --allow-untrusted flag because edge packages may not have verified signatures.
[[See Video to Reveal this Text or Code Snippet]]
Step 3: Install the Correct Package
Install the PostgreSQL 17 client using the correct package name postgresql17-client:
[[See Video to Reveal this Text or Code Snippet]]
Complete Dockerfile Example
[[See Video to Reveal this Text or Code Snippet]]
Summary
Use postgresql17-client instead of postgresql-client17.
Enable Alpine's edge main repository to access the latest package versions.
Use --allow-untrusted when working with edge/testing packages.
With these changes, the PostgreSQL 17 client should install successfully in the Alpine-based Docker image.
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: