- Proxy authentication with HTTP_PROXY_AUTH? #305
- Comments
- nathanpw commented Jul 13, 2017 •
- Русские Блоги
- менеджер пакетов alpine Linux-apk, просто используйте его
- Name already in use
- nexus-repository-apk / docs / APK_USER_DOCUMENTATION.md
- Русские Блоги
- менеджер пакетов alpine Linux-apk, просто используйте его
- Working with the Alpine Package Keeper ( apk )
- Normal Usage
- Repositories, Releases and Mirrors
- Searching for Packages
- Installing Packages
- Upgrading Packages
- Querying Package Information
- Removing Packages
- Cleanup
- Advanced Usage
- World
- Virtuals
- Swapping Repositories
Proxy authentication with HTTP_PROXY_AUTH? #305
Comments
nathanpw commented Jul 13, 2017 •
Hi, thanks for the great docker images. I am hoping to get some help with a proxy problem, or some direction. Here is the message I am getting.:
UPDATE/EDIT: It looks like this is reproducible only if I have a bang (!) in my password. I tried encoded (%21) and just the character (!) and both fail out with the same error below when in HTTP_PROXY.
This seems to have started this week on some docker containers we use for PHP development (based on alpine). We are behind a proxy that requires authentication. We have been using the http_proxy environment variables with our user name and password inline. This is set when we build the images ( docker build —build-arg HTTPS_PROXY=$$HTTP_PROXY ). i.e.:
HTTP_PROXY=http://user:pass@proxyserver:port
HTTPS_PROXY=http://user:pass@proxyserver:port
http_proxy=http://user:pass@proxyserver:port
https_proxy=http://user:pass@proxyserver:port
This has worked for the last couple months without issues. However, now it seems we need to use HTTP_PROXY_AUTH ? I noticed this in : #191 (comment)
Here is an excerpt of our Dockerfile where it is failing (specifically on docker-php-ext-install xdebug as it needs to apk add ).:
To work around this I changed the code to:
If I do this for https the clone fails with message:
In troubleshooting I was also able to use curl and wget without setting HTTP_PROXY_AUTH.
Looking at the man for libfetch I think this maybe an issue there? Maybe this was updated recently in alpine?
Specifies authorization parameters for the HTTP proxy in the sameformat as the HTTP_AUTHvariable.
This variable is used if and only if connected to an HTTP proxy, andis ignored if a user and/or a password were specified in the proxyURL.
http://rpm.pbone.net/index.php3/stat/45/idpl/33638817/numer/3/nazwa/fetch
The text was updated successfully, but these errors were encountered:
Русские Блоги
менеджер пакетов alpine Linux-apk, просто используйте его
Alpine предоставляет очень полезный инструмент управления пакетами apk с помощью команды apk -help для просмотра полных команд управления пакетами.
update: обновить индекс источника локального зеркала из источника удаленного зеркала. Команда обновления загрузит APKINDEX.tar.gz из каждого списка источников зеркала и сохранит его в локальном кеше, обычно в / var / cache / apk / (Alpine находится в этом каталоге), / var / lib / apk /, / etc / apk / cache /
add: команда устанавливает последнюю версию программного обеспечения со склада и автоматически устанавливает необходимые зависимые пакеты.Вы также можете добавить программные пакеты со стороннего склада. add: установить ПАКЕТЫ и автоматически разрешить зависимости.
apk add openssh openntp vim
apk add —no-cache mysql-client
apk add docker —update-cache —repository http://mirrors.ustc.edu.cn/alpine/v3.4/main/ —allow-untrusted
Установить указанную версию пакета
apk add asterisk=1.6.0.21-r0
apk add ‘asterisk 1.6.1
del: удалить и удалить ПАКЕТЫ
apk del openssh openntp vim
Команда upgrade обновляет все программные пакеты, установленные в системе (как правило, включая ядро). Конечно, вы также можете указать обновление только части программных пакетов (выбранных с помощью -u или -upgrade).
apk update # Обновление последнего источника локального зеркала
apk upgrade # Обновить программное обеспечение
apk add —upgrade busybox # Укажите часть обновления пакета
Команда поиска выполняет поиск доступных пакетов программного обеспечения, параметр -v выводит содержание описания, подстановочный знак расходов, а параметр -d или -description указывает поиск по описанию пакета.
apk search # Найти все доступные пакеты
apk search -v # Найти все доступные пакеты и их описание
apk search -v’acf * ‘# Найти пакет по имени пакета
apk search -v -d’docker ‘# Найти конкретный пакет через файл описания
Просмотр информации о пакете
Команда info используется для отображения информации о программном пакете.
apk info # Список всех установленных пакетов
apk info -a zlib # Показать полную информацию о пакете
apk info —who-owns / sbin / lbu # Показать пакет, которому принадлежит указанный файл
Name already in use
nexus-repository-apk / docs / APK_USER_DOCUMENTATION.md
- Go to file T
- Go to line L
- Copy path
- Copy permalink
Copy raw contents
Copy raw contents
apk is the built-in package manager for Alpine Linux, a security-oriented, lightweight Linux distribution based on musl libc and Busybox.
Proxying apk repository
You can create a proxy repository in Nexus Repository Manager (NXRM) that will cache packages from a remote apk repository such as http://dl-cdn.alpinelinux.org/alpine/v3.10/main/. To make Alpine use your NXRM Proxy, you will need to edit the file located at /etc/apk/repositories . More information can be found here.
To proxy a apk repository, you simply create a new ‘apk (proxy)’ as documented in Repository Management.
Minimal configuration steps are:
- Define ‘Name’ — e.g. apk-proxy
- Define URL for ‘Remote storage’ — e.g. http://dl-cdn.alpinelinux.org/alpine/v3.10/main/
- Select a Blob store for Storage
If you haven’t already, edit the Apline file located at /etc/apk/repositories to use your apk-proxy (i.e. add http://localhost:8081/repository/apk-proxy/ and comment out or delete the other remote repo locations).
Now you can run apk update and install a package with the apk add command, like apk add git .
The command above tells apk to update the index of available packages and install the package from your NXRM apk proxy. The NXRM apk proxy will download any missing packages from the remote apk repository, and cache the packages on the NXRM apk proxy. The next time any client requests the same package from your NXRM apk proxy, the already cached package will be returned to the client.
Русские Блоги
менеджер пакетов alpine Linux-apk, просто используйте его
Alpine предоставляет очень полезный инструмент управления пакетами apk с помощью команды apk -help для просмотра полных команд управления пакетами.
update: обновить индекс источника локального зеркала из источника удаленного зеркала. Команда обновления загрузит APKINDEX.tar.gz из каждого списка источников зеркала и сохранит его в локальном кеше, обычно в / var / cache / apk / (Alpine находится в этом каталоге), / var / lib / apk /, / etc / apk / cache /
add: команда устанавливает последнюю версию программного обеспечения со склада и автоматически устанавливает необходимые зависимые пакеты.Вы также можете добавить программные пакеты со стороннего склада. add: установить ПАКЕТЫ и автоматически разрешить зависимости.
apk add openssh openntp vim
apk add —no-cache mysql-client
apk add docker —update-cache —repository http://mirrors.ustc.edu.cn/alpine/v3.4/main/ —allow-untrusted
Установить указанную версию пакета
apk add asterisk=1.6.0.21-r0
apk add ‘asterisk 1.6.1
del: удалить и удалить ПАКЕТЫ
apk del openssh openntp vim
Команда upgrade обновляет все программные пакеты, установленные в системе (как правило, включая ядро). Конечно, вы также можете указать обновление только части программных пакетов (выбранных с помощью -u или -upgrade).
apk update # Обновление последнего источника локального зеркала
apk upgrade # Обновить программное обеспечение
apk add —upgrade busybox # Укажите часть обновления пакета
Команда поиска выполняет поиск доступных пакетов программного обеспечения, параметр -v выводит содержание описания, подстановочный знак расходов, а параметр -d или -description указывает поиск по описанию пакета.
apk search # Найти все доступные пакеты
apk search -v # Найти все доступные пакеты и их описание
apk search -v’acf * ‘# Найти пакет по имени пакета
apk search -v -d’docker ‘# Найти конкретный пакет через файл описания
Просмотр информации о пакете
Команда info используется для отображения информации о программном пакете.
apk info # Список всех установленных пакетов
apk info -a zlib # Показать полную информацию о пакете
apk info —who-owns / sbin / lbu # Показать пакет, которому принадлежит указанный файл
Working with the Alpine Package Keeper ( apk )
apk is the Alpine Package Keeper — the distribution’s package manager. It is used to manage the packages (software and otherwise) of the system. It is the primary method for installing additional software, and is available in the apk-tools package.
Normal Usage
Repositories, Releases and Mirrors
apk fetches information about available packages, as well as the packages themselves from various mirrors, which contain various repositories. Sometimes, those terms are used interchangeably. Here is a summary of relevant definitions:
A website that hosts repositories.
A collection of snapshots of various repositories.
A category of packages, tied together by some attribute.
Currently, three repositories exist:
Officially supported packages that are reasonable to expect to be in a basic system.
Packages from testing that have been tested.
New, broken, or outdated packages that need testing. Only available on edge .
Two types of releases exist:
Released every 6 months. Support entails security patches for the given feature versions. Each stable release has its own main and community repositories. The main repository is supported for 2 years. The community repository is only supported for 6 months of its respective release. A release is considered EOL (End Of Life) when support of its main repo expires.
A rolling release branch. It includes newest packages built from the master branch of the aports repository. It’s less stable than release branches, but is stable enough for daily use and is useful for development or if you need up to date software. It has its own main and community repos, just like stable releases. It also has the testing repository, which increases the number of available packages significantly.
It is technically possible to mix different branches, that is to say to enable the testing repository while using main and community from stable. However, this approach is discouraged and will cause breakages. |
Repositories are configurable in the /etc/apk/repositories file. Each line corresponds to a repository. The format is as follows:
In this case, http:// is the protocol, dl-cdn.alpinelinux.org/alpine is the path, edge is the release and main is the repository. |
In this case, @testing is the tag. More on this in Installing Packages. |
In this case, the repository is a personal one, available on the filesystem of the machine. |
This example uses the http:// protocol. ftp:// and https:// protocols are also supported. |
This file should already have been been partially populated when you installed alpine. |
Searching for Packages
In order to know what package to install, one must be able to find packages. Alpine has a specialized web interface dedicated to looking through various available packages. However, apk also provides a built-in searching mechanism. You invoke it by using the apk search subcommand. You can potentially search for anything in the package index, which, among other things, includes provided binaries and libraries). Further, globbing is supported. As such, here are a few examples of searching:
You can search for partial library names. |
You can also search for binary names. |
You can exclude partial matches using -e . |
You can specify that what you’re searching for is a library using the so: prefix (or the cmd: prefix for commands, and pc: prefix for pkg-config files) — it will work with -e (in fact, the prefix is required for this use-case if -e is used). |
Installing Packages
Once you know what package you want to install, you must know how to do that. Apk’s add command is more strict than the search command — wildcards are not available, for instance. However, the cmd: , so: and pc: prefixes are still available.
While the so: prefix is still available for apk add , it is recommended that you avoid using it. This is because the provided library SONAME version can increase (for example, libmpack.so.0 may get updated, and become libmpack.so.1 ), in which case this will not update libmpack next time you run apk upgrade , and will instead fail. This is because so:libmpack.so.0 directly refers to that specific version of the library, and is typically used by packages, rather than users directly.
While the cmd: and pc: prefix is still available for apk add , you should know that it does not guarantee getting you the exact package you are looking for. Multiple packages can contain the same executable command or pkg-config definition, but only one will be selected — not necessarily the one you want.
Here are a few examples of adding packages:
You must specify the exact package name. |
You may add multiple packages at once. |
This should be equivalent to the previous example, but specifies the command you are interested in. |
It is possible, but discouraged, to specify specific desired libraries. |
Finally, it is possible to specify pkg-config dependencies. |
If apk add finds multiple matching packages (for example multiple cmd: matches), it will select the one with the highest version number. |
Upgrading Packages
Updating the system using apk is very simple. One need only run apk upgrade . Technically, this is two steps: apk update , followed by apk upgrade proper. The first step will download an updated package index from the repositories, while the second step will update all packages in World, as well as their dependencies.
apk will avoid overwriting files you may have changed. These will usually be in the /etc directory. Whenever apk wants to install a file, but realizes a potentially edited one is already present, it will write its file to that filename with .apk-new appended. You may handle these by hand, but a utility called update-conf exists. Simply invoking it normally with present you with the difference between the two files, and offer various choices for dealing with the conflicts.
apk update is only ran once your cache is invalidated, which by default happens every 4 hours. |
Querying Package Information
In some cases, it may be useful to inspect packages or files to see various details. For this use, the info subcommand exists. It may be used on any package, installed or not, though the information on the latter will be more limited. It may also be used with specific flags on files. By default, info will list the package description, webpage and installed size. For more details (such as a list of flags the subcommand supports), you can use the apk info -h output’s «Info options» section or see the manual page.
Removing Packages
Often, it is desirable to remove a package. This can be done using the del subcommand, with a base syntax that is identical to the add subcommand.
If you added a package using the cmd: , so: or pc: virtual, you must specify the same virtual to remove them. NOTE: Removing a package will automatically remove all of its dependencies that are otherwise not used. |
The del subcommand also supports the -r flag, which will remove all packages that depend on the package being removed as well, rather than error out due to the package being needed.
Cleanup
Many package managers have specific features to «clean up». A common one is apt , which has an autoremove subcommand. Apk does this by default when removing packages.
It is also possible to clear out the apk cache, assuming it is enabled. You can do this using apk cache clean .
Advanced Usage
World
The packages you want to have explicitly installed are listed in the «world file», available in /etc/apk/world . It is safe to edit it by hand. If you’ve edited it by hand, you may run apk add with no arguments to bring the package selection to a consistent state.
Virtuals like cmd: , so: and pc: will appear as such in your world file — this is why using so: is discouraged — the soname might get bumped! |
Virtuals
While cmd: , so: and pc: packages are automatically created virtuals, you can create your own as well. These allow for quick removal of purpose-specific packages. See the following examples for details:
This will add the packages «a», «b» and «c» as the dependencies of a virtual package «abc». |
This will remove «abc» and all of its components («a», «b» and «c»), unless they are required elsewhere. |
This is equivalent to the first example. |
Swapping Repositories
When alpine has a new release, the repository path will change. Assuming you are going forward in time (e.g from 3.12 to 3.13 ), you can simply edit /etc/apk/repositories and run apk upgrade —available .
Downgrading packages/versions is currently not supported. While it is technically possible, you are on your own.
Copyright © 2019 Alpine Linux Development Team. All rights reserved.