docker-alpine: apk WARNING Ignoring APKINDEX No such file or directory

I see a few issues related to this but they’re all making it more complex to replicate.

Just running the following gets the WARNING. Start from a “blank” host (no images loaded, no containers running)

docker run --rm -it alpine:3.4 apk info

output:

WARNING: Ignoring APKINDEX.5a59b88b.tar.gz: No such file or directory
WARNING: Ignoring APKINDEX.7c1f02d6.tar.gz: No such file or directory
musl
busybox
alpine-baselayout
alpine-keys
zlib
libcrypto1.0
libssl1.0
apk-tools
scanelf
musl-utils
libc-utils

Tested on both VMware Fusion and Docker4mac. I also get the same WARNING using alpine:3.3

About this issue

Commits related to this issue

Most upvoted comments

doing apk update fixes the problem (updates the index).

Request: Improve the error message.

thing that work for me ‘docker build –network=host .’

This worked for me:

In your DOCKERFILE (in this one order):

First: Remove cache and tmp files

RUN rm -rf /var/cache/apk/* && \
    rm -rf /tmp/*

Second: Update

RUN apk update

@dustinbarnes

I just had this issue, what fixed it for me is running the update as:

apk --update add --no-cache <yourPackage>

I’m also having this issue with 3.7, but while building docker containers:

Step 2/28 : RUN echo "http://dl-cdn.alpinelinux.org/alpine/v3.7/main" > /etc/apk/repositories
 ---> Using cache
 ---> d41c056fd55a
Step 3/28 : RUN apk update && apk upgrade --available && sync
 ---> Running in 3058e7cea18e
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
ERROR: http://dl-cdn.alpinelinux.org/alpine/v3.7/main: temporary error (try again later)
WARNING: Ignoring APKINDEX.70c88391.tar.gz: No such file or directory
1 errors; 69 distinct packages available
The command '/bin/sh -c apk update && apk upgrade --available && sync' returned a non-zero code: 1

sudo systemctl stop/start docker worked for me !

Re-opening this issue. It’s obviously causing a lot of headaches still.

Dont use:

$ apk --update add --no-cache <yourPackage>

Because it will just ignore --no-cache and create cache files in /var/cache/apk anyways.

Error persists on alpine 3.7 – JUST FOUND SOLUTION – SEE BELOW

/ # apk update

fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz ERROR: http://dl-cdn.alpinelinux.org/alpine/v3.7/main: temporary error (try again later) WARNING: Ignoring APKINDEX.70c88391.tar.gz: No such file or directory fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz ERROR: http://dl-cdn.alpinelinux.org/alpine/v3.7/community: temporary error (try again later) WARNING: Ignoring APKINDEX.5022a8a2.tar.gz: No such file or directory 2 errors; 11 distinct packages available

Restarted docker (running on bare metal debian 9) – no change. Updated to latest DNS/bind etc. – no change. Cleared /tmp/* and /var/cache/apk/* as suggested – no change. Tried changing /etc/apk/repositories to use “dl-4” instead of “dl-cdn” – no change.

Tried apk --no-cache update – gives this different error: fetch http://dl-4.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz ERROR: http://dl-4.alpinelinux.org/alpine/v3.7/main: temporary error (try again later) fetch http://dl-4.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz WARNING: Ignoring http://dl-4.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz: temporary error (try again later) fetch http://dl-4.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz ERROR: http://dl-4.alpinelinux.org/alpine/v3.7/community: temporary error (try again later) fetch http://dl-4.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz WARNING: Ignoring http://dl-4.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz: temporary error (try again later) 2 errors; 11 distinct packages available

on bare metal debian 9 host: /root # host dl-cdn.alpinelinux.org dl-cdn.alpinelinux.org is an alias for global.prod.fastly.net. global.prod.fastly.net has address 151.101.200.249

/root # host dl-4.alpinelinux.org dl-4.alpinelinux.org is an alias for nl3.alpinelinux.org. nl3.alpinelinux.org has address 147.75.32.21

but inside alpine:3.7 container: / # host dl-cdn.alpinelinux.org / # host dl-4.alpinelinux.org both timed out

Discovered problem is DJB-DNS running on bare metal host – it needed to be told to respond to DNS queries coming from 172.x.y.z (the docker containers): /root # touch /service/dnscache/root/ip/172

Please improve the message to be actionable, see http://blog.schlomo.schapiro.org/2015/04/warning-is-waste-of-my-time.html for rationale.

This is very-very annoying. I was able to ping/download from the repos through my browser, but could not install vim neither anything because of this error:

docker run -ti alpine /bin/sh
Unable to find image 'alpine:latest' locally
latest: Pulling from library/alpine
Digest: sha256:7df6db5aa61ae9480f52f0b3a06a140ab98d427f86d8d5de0bedab9b8df6b1c0
Status: Downloaded newer image for alpine:latest
/ # apk add --no-cache vim
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
WARNING: Ignoring http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz: BAD signature
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
ERROR: unsatisfiable constraints:
  vim (missing):
    required by: world[vim]

SOLUTION that worked for me:

apk add --no-cache --wait 10 vim    <<--- Using `wait`

@agathebower

This command is not work.

$ sudo docker run --rm alpine ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
^C
--- 8.8.8.8 ping statistics ---
9 packets transmitted, 0 packets received, 100% packet loss

But, this command is work.

$ sudo docker run --rm --network=host alpine ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
64 bytes from 8.8.8.8: seq=0 ttl=54 time=4.240 ms
64 bytes from 8.8.8.8: seq=1 ttl=54 time=11.171 ms
^C
--- 8.8.8.8 ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 4.240/7.705/11.171 ms

This worked for me:

In your DOCKERFILE (in this one order):

First: Remove cache and tmp files

RUN rm -rf /var/cache/apk/* && \
    rm -rf /tmp/*

Second: Update

RUN apk update

Tks this worked for me.

Error : ERROR: http://dl-cdn.alpinelinux.org/alpine/v3.8/main: IO ERROR WARNING: Ignoring APKINDEX.adfa7ceb.tar.gz: No such file or directory

“–network=host” option worked for me

I faced this issue today and it was caused by conflicting firewall rules added by firewalld.

# systemctl stop firewalld
# systemctl disable firewalld
# systemctl restart docker

And the error was gone.

Environment: Fedora 33 Beta, Docker CE 19.03.13

I found this, and it’s solves the issue without killing the firewalld

firewall-cmd --permanent --zone=trusted --add-interface=docker0
firewall-cmd --reload

I faced this issue today and it was caused by conflicting firewall rules added by firewalld.

# systemctl stop firewalld
# systemctl disable firewalld
# systemctl restart docker

And the error was gone.

Environment: Fedora 33 Beta, Docker CE 19.03.13

@kotauchisunsun and @lexyan solution using --network=host option worked for me. Thanks.

TL; DR

docker build --network=host .

TS; DR

I noticed that the CDN itself isn’t the issue because downloading directly from the host succeeds.

$ # fail to fetch from CDN. Here it seems that CDN is down.
$ docker build -t sample .
...
Step 4/18 : RUN apk add --no-cache --update   ca-certificates   curl   ffmpeg   git   make   rtmpdump   tzdata
 ---> Running in 97d093634b58
fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/main/armhf/APKINDEX.tar.gz
WARNING: Ignoring http://dl-cdn.alpinelinux.org/alpine/v3.10/main/armhf/APKINDEX.tar.gz: IO ERROR
fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/community/armhf/APKINDEX.tar.gz
WARNING: Ignoring http://dl-cdn.alpinelinux.org/alpine/v3.10/community/armhf/APKINDEX.tar.gz: IO ERROR
ERROR: unsatisfiable constraints:
  curl (missing):
          ⋮
  tzdata (missing):
    required by: world[tzdata]
The command '/bin/sh -c apk add --no-cache --update   ca-certificates   curl   ffmpeg   git   make   rtmpdump   tzdata' returned a non-zero code: 6
$ # but direct download from the host, CDN seems working 
$ curl -O http://dl-cdn.alpinelinux.org/alpine/v3.10/main/armhf/APKINDEX.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  731k  100  731k    0     0  1879k      0 --:--:-- --:--:-- --:--:-- 1879k
$ # Re-try using host's network
$ docker build -t sample --network=host .
...
Step 4/18 : RUN apk add --no-cache --update   ca-certificates   curl   ffmpeg   git   make   rtmpdump   tzdata
 ---> Running in 82abec1ef8e5
fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/main/armhf/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/community/armhf/APKINDEX.tar.gz
(1/55) Installing nghttp2-libs (1.39.2-r0)
(2/55) Installing libcurl (7.66.0-r0)
(3/55) Installing curl (7.66.0-r0)
(4/55) Installing sdl2 (2.0.10-r0)
...
$ # 🎉 

So, maybe somehow the MTU might differ between the host’s network and Docker network, I assume.

  • Docker: 18.06.3-ce
  • Base image: Alpine Linux v3.10.3
  • Host: macOS Catalina 10.15.7

I faced this issue today and it was caused by conflicting firewall rules added by firewalld.

# systemctl stop firewalld
# systemctl disable firewalld
# systemctl restart docker

And the error was gone. Environment: Fedora 33 Beta, Docker CE 19.03.13

I found this, and it’s solves the issue without killing the firewalld

firewall-cmd --permanent --zone=trusted --add-interface=docker0
firewall-cmd --reload

this I try “–network=host” but failed, and this helps me resolve the issue (Fedora 36 here)

For me it was because of EOF conversion from Windows (notepad++) to Unix (LF)

Always edit file via Unix editor first

I finally solved it. I just turned on VPN.

Had the same problem, by fixing the /etc/resolv.conf and setting DNS it fixed!

on bare metal, I think this will solve the issue:

I was getting:

bare-metal-host:~# apk update fetch http://mirror.math.princeton.edu/pub/alpinelinux/armhf/APKINDEX.tar.gz ERROR: http://mirror.math.princeton.edu/pub/alpinelinux/: No such file or directory WARNING: Ignoring APKINDEX.bcf95d26.tar.gz: No such file or directory fetch http://mirror.math.princeton.edu/pub/alpinelinux/v3.8/main/armhf/APKINDEX.tar.gz fetch http://mirror.math.princeton.edu/pub/alpinelinux/v3.8/community/armhf/APKINDEX.tar.gz v3.8.4-46-gd19f2800a1 [http://mirror.math.princeton.edu/pub/alpinelinux/v3.8/main] v3.8.4-44-g70fa4e605a [http://mirror.math.princeton.edu/pub/alpinelinux/v3.8/community] 1 errors; 9337 distinct packages available

I solved this by setting my /etc/apk/repositories file as such:

#http://mirror.math.princeton.edu/pub/alpinelinux/ http://mirror.math.princeton.edu/pub/alpinelinux/v3.8/main http://mirror.math.princeton.edu/pub/alpinelinux/v3.8/community

error message is now gone

I don’t htink this has anything to do with alpine or anything inside the container, it’s simply a docker network problem. You can check it with docker run --rm alpine:3.8 ping 8.8.8.8 For me this is working on 5 of 6 100% identicaly provisioned nodes but not on the 6th.

I got the same issue . But the strange thing is running with all proxy environment did not worked. For me it got resolved when I’ve not running behind proxy that is without using connecting to VPN, then it allowing in plain vanila network apk update works.