In Debian, one can install apt-transport-tor, which allows packages to be downloaded over tor (to prevent an observer from seeing what packages you are installing). Is there an equivalent in Alpine Linux, or a way to configure apk to work through a SOCKS5 proxy?

1 Answer 1


apk does not have built-in support for tor. But still you can use tor and torsocks in order to accomplish the same result. Alpine has both packages already available since version 3.5, so you can simply type:

apk add tor torsocks

Copy torrc.sample shipped in /etc/tor to /etc/tor/torrc and modify the config file according to your needs/setup.

A very simple config for /etc/tor/torrc is:

Log notice file /var/log/tor/notices.log
DataDirectory /var/lib/tor
ControlPort 9051
CookieAuthentication 0

Then, start tor with:

 rc-service tor start

Verify that your tor anonymizer is working with:

 torify curl ipinfo.io

The ip address shouldn't be your public ip address.

At this point, you can go ahead and use apk with torify:

 torify apk update

apk has support for proxy via env variable HTTP_PROXY. At this point then you have several options. You might want to consider also sshuttle [*] (this is shipped by Alpine as well), and route the traffic for alpinelinux repositories subnet only via sshuttle.

[*] https://github.com/sshuttle/sshuttle

Hope it helps.

.: Francesco

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .