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

Created on 22 Aug 2016  ·  44Comments  ·  Source: gliderlabs/docker-alpine

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

Most helpful comment

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

Request: Improve the error message.

All 44 comments

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

Request: Improve the error message.

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 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

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

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

So? What solution for this problem?

touch /service/dnscache/root/ip/172 <----> No such file or directory

maybe your Docker DNS not work, try "docker run" with "--dns xxx.xxx.xxx.xxx ".
like
docker run --privileged --dns xxx.xxx.xxx.xxx --name testxxxx -dit gliderlabs/alpine

@dustinbarnes

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

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

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`

Dont use:

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

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

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

Where can we follow this issue? I have a headache too. Not even with docker. Just in a kvm. Same problems.

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.

Seeing the same thing:

> docker run -it --rm alpine:3.7
Unable to find image 'alpine:3.7' locally
3.7: Pulling from library/alpine
c67f3896b22c: Pull complete
Digest: sha256:a52b4edb6240d1534d54ee488d7cf15b3778a5cfd0e4161d426c550487cddc5d
Status: Downloaded newer image for alpine:3.7
/ #
/ #
/ # 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: BAD signature
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: BAD signature
WARNING: Ignoring APKINDEX.5022a8a2.tar.gz: No such file or directory
2 errors; 13 distinct packages available

is there any other solutions? my alpine is 3.8

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.

For me it was an issue with Docker and DNS config, therefore "ping 8.8.8.8" worked fine while "ping dl-cdn.alpinelinux.org" did not. I solved it by copying a docker config specific to our company intranet, but something generic like this could work for others

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

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

This WORKED for me as well.

I was facing following errors:-
WARNING: Ignoring APKINDEX.adfa7ceb.tar.gz: No such file or directory
WARNING: Ignoring APKINDEX.efaa1f73.tar.gz: No such file or directory

Thanks for the solution.

You can use:
docker run -e OR docker build --build-arg to pass http_proxy env variable required for apk package manager

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

I can confirm this solution worked for me as well in my Dockerfile in a custom build.

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

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

I got the same issue. From docker container "ping 8.8.8.8" worked fine while "ping dl-cdn.alpinelinux.org" did not. I have check DNS configuration of other Host machines in my network and configured the same nameserver for docker also then after it works.
Solution:
Supplied DNS configuration while starting dockerd using --dns option.
If the machine has systemd service controller then you can find docker service file at the following location. Change ExecStart command in in docker.service file and restart docker service.
/lib/systemd/system/docker.service
ExecStart=/usr/bin/dockerd --dns <nameserver-IP> -H fd:// --containerd=/run/containerd/containerd.sock
https://success.docker.com/article/how-do-i-set-the-docker-daemon-options

For anyone still struggling with this, I fixed this by having a VPN turned on whilst building the Docker image. No idea why it worked, apologies.

so these are the ideas, that came up so far...

  • apk update

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

  • restarted docker daemon

  • restarted docker daemon with explicid dns option in .service

  • apk --update ...

  • apk add --no-cache ...

  • apk --update add --no-cache ...

  • apk add --no-cache --wait 10 ...

sadly this didn't do the trick for me :(
any news on this?

@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

Insert in Dockerfile next string:

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

RUN apk update

Next restart docker

And next run build docker image.

thing that work for me 'docker build --network=host .'

sudo systemctl stop/start docker worked for me !

thing that work for me 'docker build --network=host .'

This forces docker to use the host network to resolve DNS requests?

@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

```shellsession
$ # 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

```shellsession
$ # 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

As far i'm concerned, I even tried this one https://github.com/gliderlabs/docker-alpine/issues/509 and it did'nt work till I even restart my pc.

Finally, I changed the network (wifi from library) i was logged to my personal smartphone and it fixed it

sudo systemctl stop/start docker 为我工作!

good

I finally solved it. I just turned on VPN.

I used
sudo systemctl restart docker && sudo systemctl restart NetworkManager

and then, if you have a docker-compose.yaml file.
docker-compose build

Regards!

I got the same error when I run docker build ..
Dockerfile:

FROM adoptopenjdk/openjdk11:alpine


 # install maven
RUN rm -rf /var/cache/apk/* && \
     rm -rf /tmp/* && \
apk update && \
apk add --no-cache curl tar bash

/// the rest of command

when I build the image, I got this error:
Sending build context to Docker daemon 62.65MB Step 1/16 : FROM adoptopenjdk/openjdk11:alpine ---> 6b1ec1e25ce8 Step 2/16 : RUN rm -rf /var/cache/apk/* && rm -rf /tmp/* && apk update && apk add --no-cache curl tar bash ---> Running in 2302d9fff9a7 fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz ERROR: http://dl-cdn.alpinelinux.org/alpine/v3.12/main: DNS lookup error WARNING: Ignoring APKINDEX.2c4ac24e.tar.gz: No such file or directory fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz 2 errors; 17 distinct packages available ERROR: http://dl-cdn.alpinelinux.org/alpine/v3.12/community: DNS lookup error WARNING: Ignoring APKINDEX.40a3604f.tar.gz: No such file or directory The command '/bin/sh -c rm -rf /var/cache/apk/* && rm -rf /tmp/* && apk update && apk add --no-cache curl tar bash' returned a non-zero code: 2
I'm using windows 10 and I'm connecting on VPN made by the company.
How can I fix that?

ERROR: .... DNS lookup error
How can I fix that?

Maybe fix your DNS?

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 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

"--network=host" option worked for me

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

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

Always edit file via Unix editor first

This error happened to me because I had removed the docker's default bridge network in /etc/docker/daemon.json.
Here is a fix :

{
 "default-address-pools":
 [
 {"base":"10.10.0.0/16","size":24}
 ]
}

And choose a default subnet that is not used or resolved in your network.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kooksee picture kooksee  ·  4Comments

nrvnrvn picture nrvnrvn  ·  4Comments

rmNyro picture rmNyro  ·  4Comments

u6f6o picture u6f6o  ·  4Comments

frebib picture frebib  ·  4Comments