docker-alpine: apk fails to update/add.
Hey there!
I’m new to docker, and new to alpine in general. I love the work you’ve done and think it’s fantastic for a container-centric future. I’m running into issues using apk update and apk add, in addition to apk-install using the base image provided by gliderlabs/docker-alpine:3.1 (and :3.2, for that matter).
Using a Dockerfile that looks like:
FROM gliderlabs/alpine:3.1
RUN apk --update add mysql-client
ENTRYPOINT ["mysql"]
I get this error:
Step 1 : RUN apk --update add mysql-client
---> Running in 9129d237031e
fetch http://dl-4.alpinelinux.org/alpine/v3.1/main/x86_64/APKINDEX.tar.gz
ERROR: http://dl-4.alpinelinux.org/alpine/v3.1/main: IO ERROR
WARNING: Ignoring APKINDEX.689bb31a.tar.gz: No such file or directory
ERROR: unsatisfiable constraints:
mysql-client (missing):
required by: world[mysql-client]
The command '/bin/sh -c apk --update add mysql-client' returned a non-zero code: 1
After doing some research (which was rather annoying, as the Alpine Linux wiki is down – yay google cache and archive.org), everything I was attempting to do seemed to be correct.
Logically, I figured it was an issue with the repository sources. No problem, let’s open up /etc/apk/repositores.
Whoops! It looks like by default, you only have http://dl-4.alpinelinux.org/alpine/v3.1/main. I ran into #15 and discovered a list of mirrors which have been most helpful. It currently looks like the following sources are currently failing:
http://dl-3.alpinelinux.org/alpine/v3.1/main
http://dl-4.alpinelinux.org/alpine/v3.1/main
1, 2, and 5 are peachy. I propose adding mirrors to the repositories included in your base image. While it’s easy enough for people to add the mirrors themselves, it will save time in the long run, especially for newer users.
Edit (next day): 3 and 4 back up. It would seem the logical choice to add all five mirrors by default.
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 56 (4 by maintainers)
try to add RUN echo “ipv6” >> /etc/modules in your dockerfile before apk update, Its working for me, I’m going to do a pull request if it fixes it for somebody else
@rayyen @Skarlso @oryband ran into the same problem, my solution is simply add
--no-cacheflag and that works like a charmNevermind I found that I need to specify :
@dhruvasagar Does this still the only solution?? I’m trying to use
3.9.4(right now it’s the “latest” from Alpine) and can’t installchshnorusermod- but I can installopensshwithout any issue 🤔Already tried downgrading all the way down to
3.4but still getting this error no matter what:Same for
usermod.Had the same problem. It wasn’t a problem with alpine at all. I just simply had to restart my virtual machine as I have changed my wifi to a different one. Silly but might help someone.
@jckimble: I created this issue on July 26 2015. The issue, as I discovered, was simply that the alpine base image (not just gliderlabs’ – but the base alpine:3.2 image) only contains the dl-3 and dl-4 repositories.
On the day that I reported the issue, at the time I reported it, dl-3 and dl-4 were both failing to respond, causing apk update/add commands to hang until failure. I edited the post on the next day, July 27 2015, and noted that dl-3 and dl-4 were back online.
I’m leaving leaving this issue open, and not not self-closing closing it, for two reasons.
Missing settings for the DNS-Server in docker was in my case the cause of this error: I added the dns-servers into
/etc/docker/daemon.json{ "dns": [own_dns,"8.8.8.8","8.8.8.4"] }service docker restartAnd then it worked.dint Under stand the root cause of the issue
I just changed the order of main and community repos, so the resulting the /etc/apk/repositories file looks like as following: http://dl-cdn.alpinelinux.org/alpine/v3.4/community http://dl-cdn.alpinelinux.org/alpine/v3.4/main
And it worked. If the “main” repo was in the first line of repositories file even waiting for 30 seconds with “apk update --wait 30” didn’t resolve the issue. Maybe not a solution, but might help to someone.
@mishak87 Seeing this too
Just a
docker pullworked. My image was too old…Hello,
I post here because what I am seeing is exactly what was originally posted here (not in the other issues). In my Dockerfile I have :
And it has been 2 days I get the following errors :
I can ping totally fine both repositories from the virtualbox VM where I run the build command…
It was the corporate proxy in my case 😕
I fixed this issue by adding
--dns 8.8.8.8 --dns 8.8.4.4to myDOCKER_OPTSin/etc/default/dockerand restarting docker.@wanjochan, @jasetom: https://docs.docker.com/v1.8/articles/networking/
@jasetom 's solution is wonderfully correct… just ‘service docker restart’ the problem solved…what the f*ck… but what if the docker is running in non-root mode… can’t tell the admin to restart…too shame… hope the next version of docker is more stable then
I’m getting this error with rkt
Hello,
First thanks again for your fast answers.
I managed to figured it out. Usually I provision my servers with ansible and I have a ferm role to configure iptables. The server I was trying to build the image on is not supposed to be a server in the cloud, more a server on my local network where I create tunnel to access specific services.
As I was not applying the ferm role, I totally forgot I had set in /etc/default/docker the --iptables=false parameter, thus resulting not having the masquerade rule and all other docker container rules (https://github.com/docker/docker/issues/13381)
I am building the image now totally fine. Sorry to made you lose some time on this… Have a good week end. Cheers
@andyshinn I added dl-1 through dl-5 in order; that is to say:
When it got to
dl-3, it hung for a while, errored out, and then moved todl-4, which hung, errored, and moved todl-5. The above is what I put as my sources in images based onalpine:3.2(the official release), and I haven’t had issues yet. This leads me to the conclusion that as long as one of the repositories listed in/etc/apk/repositoriesis up, the user should be able to run apk commands successfully.Also, you said that “This is definitely related to #55” – this is #55. Was that a mistake?