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.
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
@jckimble as i noted, it was due to the repositories literally being offline.
oh sorry, I was using dl-4 earlier today and that fixed it for me, I guess it came back up between yesterday and today
@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.
When you fixed the problem by adding additional repositories, did you add them under dl-4 and observe that dl-4 would fail and then go to the next repository? This is definitely related to #55 and I think we will get a couple more repositories to the list. But I've had mixed reports of how it actually fails over and want to understand it a bit more first.
@andyshinn I added dl-1 through dl-5 in order; that is to say:
http://dl-1.alpinelinux.org/alpine/v3.2/main
http://dl-2.alpinelinux.org/alpine/v3.2/main
http://dl-3.alpinelinux.org/alpine/v3.2/main
http://dl-4.alpinelinux.org/alpine/v3.2/main
http://dl-5.alpinelinux.org/alpine/v3.2/main
When it got to dl-3, it hung for a while, errored out, and then moved to dl-4, which hung, errored, and moved to dl-5. The above is what I put as my sources in images based on alpine: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/repositories is 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?
My experience is that a timeout does not fail over.
Yup, I have the same problem as @tilgovi, for us it doesn't fail over, apk just sits there for however long it takes me to get pissed off and kill it to test it locally, I've never even got a timeout error from apk.
I've seen evidence around that apk does use multiple mirrors when they are defined. I've also observed that if I put in something that's totally not right that apk will ignore the "bad" mirror.
I can't remember the exact message I saw, but at the time things were very intermittent and slow from dl-4. Individual packages would timeout, sometimes mid-download, and then apk would not retry with a different mirror. That may be an issue for upstream, but in the meantime I suspect that doing something to address the reliability would help us here a lot.
Right, this has been my experience as well and is why I'm not jumping to add more mirrors to the list. I'd rather learn more about what we expect behavior to be so I can open an issue upstream. It's also possible that it is _supposed_ to failover or timeout on bad network / packet loss but is just a bug.
And yes, I meant that this is related to #61 (and probably #66 as well) :stuck_out_tongue:.
I'm going to close this in favor of #61, #66, and #4. It seems like this issue is a mix of fixes from those pull requests. Feel free to comment in those and /or re-open this if I am missing something here.
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 :
FROM alpine:3.2
ADD repositories /etc/apk/repositories
RUN apk --update add nginx
And it has been 2 days I get the following errors :
Step 1 : FROM alpine:3.2
---> 5f36db706cc4
Step 2 : ADD repositories /etc/apk/repositories
---> dde067180c33
Step 3 : RUN apk --update add nginx
---> Running in 94322b25a762
fetch http://dl-1.alpinelinux.org/alpine/v3.2/main/x86_64/APKINDEX.tar.gz
ERROR: http://dl-1.alpinelinux.org/alpine/v3.2/main: temporary error (try again later)
WARNING: Ignoring APKINDEX.e10619d8.tar.gz: No such file or directory
fetch http://dl-2.alpinelinux.org/alpine/v3.2/main/x86_64/APKINDEX.tar.gz
ERROR: http://dl-2.alpinelinux.org/alpine/v3.2/main: temporary error (try again later)
WARNING: Ignoring APKINDEX.72be7668.tar.gz: No such file or directory
fetch http://dl-3.alpinelinux.org/alpine/v3.2/main/x86_64/APKINDEX.tar.gz
ERROR: http://dl-3.alpinelinux.org/alpine/v3.2/main: temporary error (try again later)
WARNING: Ignoring APKINDEX.2f76b101.tar.gz: No such file or directory
fetch http://dl-4.alpinelinux.org/alpine/v3.2/main/x86_64/APKINDEX.tar.gz
ERROR: http://dl-4.alpinelinux.org/alpine/v3.2/main: temporary error (try again later)
WARNING: Ignoring APKINDEX.abd86498.tar.gz: No such file or directory
fetch http://dl-5.alpinelinux.org/alpine/v3.2/main/x86_64/APKINDEX.tar.gz
ERROR: http://dl-5.alpinelinux.org/alpine/v3.2/main: temporary error (try again later)
WARNING: Ignoring APKINDEX.d195cb40.tar.gz: No such file or directory
ERROR: unsatisfiable constraints:
nginx (missing):
required by: world[nginx]
The command '/bin/sh -c apk --update add nginx' returned a non-zero code: 1
I can ping totally fine both repositories from the virtualbox VM where I run the build command..
I have same problem to install https://pkgs.alpinelinux.org/package/community/x86_64/go
FROM alpine:edge
MAINTAINER PubNative Team <[email protected]>
RUN echo "ipv6" >> /etc/modules
RUN echo "http://dl-1.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories; \
echo "http://dl-2.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories; \
echo "http://dl-3.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories; \
echo "http://dl-4.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories; \
echo "http://dl-5.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories
$ docker run -it go sh
/ # apk update
fetch http://dl-4.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz
fetch http://dl-1.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz
fetch http://dl-2.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz
fetch http://dl-3.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz
fetch http://dl-5.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz
v3.3.0_rc1-143-gdad8488 [http://dl-4.alpinelinux.org/alpine/edge/main]
v3.3.0_rc1-140-g1fe0ee3 [http://dl-1.alpinelinux.org/alpine/edge/main]
v3.3.0_rc1-3-gbd9bf58 [http://dl-2.alpinelinux.org/alpine/edge/main]
v3.3.0_rc1-143-gdad8488 [http://dl-3.alpinelinux.org/alpine/edge/main]
v3.3.0_rc1-143-gdad8488 [http://dl-5.alpinelinux.org/alpine/edge/main]
OK: 5732 distinct packages available
/ # apk add go
ERROR: unsatisfiable constraints:
go (missing):
required by: world[go]
Nevermind I found that I need to specify :
echo "http://dl-2.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories; \
echo "http://dl-3.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories; \
echo "http://dl-4.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories; \
echo "http://dl-5.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories
@miry yes, your issue was simply the repositories being incorrect -- glad you got that figured out!
@trompx can you post the contents of your local repositories file that you're adding to /etc/apk/repositories?
Hello @bddenhartog,
Really sorry for the delayed answer, I've been very busy and I completly forgot about it.
So in my repositories file I had :
http://dl-1.alpinelinux.org/alpine/v3.2/main
http://dl-2.alpinelinux.org/alpine/v3.2/main
http://dl-3.alpinelinux.org/alpine/v3.2/main
http://dl-4.alpinelinux.org/alpine/v3.2/main
http://dl-5.alpinelinux.org/alpine/v3.2/main
I then tried with the following as miry suggested but still getting the same error
http://dl-1.alpinelinux.org/alpine/edge/community
http://dl-2.alpinelinux.org/alpine/edge/community
http://dl-3.alpinelinux.org/alpine/edge/community
http://dl-4.alpinelinux.org/alpine/edge/community
http://dl-5.alpinelinux.org/alpine/edge/community
Then I tried the exact same config as miry with alpine edge but still no luck.
I just tried with the new alpine:3.3 with
FROM gliderlabs/alpine:3.3
RUN apk --update add nginx
but I am still getting :
Step 1 : FROM gliderlabs/alpine:3.3
3.3: Pulling from gliderlabs/alpine
24e7cde1dbe9: Pulling fs layer
24e7cde1dbe9: Verifying Checksum
24e7cde1dbe9: Download complete
24e7cde1dbe9: Pull complete
Digest: sha256:5b01e1909959a792afc873c0b18a03658e38d81456a9c2ac79fd0fd2c48645f6
Status: Downloaded newer image for gliderlabs/alpine:3.3
---> 24e7cde1dbe9
Step 2 : RUN apk --update add nginx
---> Running in 1701191a8cb1
fetch http://alpine.gliderlabs.com/alpine/v3.3/main/x86_64/APKINDEX.tar.gz
ERROR: http://alpine.gliderlabs.com/alpine/v3.3/main: temporary error (try again later)
WARNING: Ignoring APKINDEX.207234d0.tar.gz: No such file or directory
fetch http://alpine.gliderlabs.com/alpine/v3.3/community/x86_64/APKINDEX.tar.gz
ERROR: http://alpine.gliderlabs.com/alpine/v3.3/community: temporary error (try again later)
WARNING: Ignoring APKINDEX.231b5af5.tar.gz: No such file or directory
ERROR: unsatisfiable constraints:
nginx (missing):
required by: world[nginx]
Can you try to open or curl http://alpine.gliderlabs.com/alpine/v3.3/main/ on the host having the issue? What does the host setup look like?
I can curl the url totally fine.
The host is a ubuntu 14.04 desktop (but I had the same problem previously on a Vagrant VM with ubuntu 14.04 server).
Docker version : 1.9.1
Edit : I think I must have some dns problem with docker, I can ping alpine.gliderlabs.com from the host but not inside the gliderlabs/alpine:3.3 container resulting in a "ping: bad address 'alpine.gliderlabs.com'". I will investigate more tommorrow, need some serious sleep ..
@trompx, since you're using alpine v3.3, here is what your /etc/apk/repositories file should look like:
http://dl-1.alpinelinux.org/alpine/v3.3/main
http://dl-2.alpinelinux.org/alpine/v3.3/main
http://dl-3.alpinelinux.org/alpine/v3.3/main
http://dl-4.alpinelinux.org/alpine/v3.3/main
http://dl-5.alpinelinux.org/alpine/v3.3/main
Note the version number in the second to last section of the URL. That's important, and you'll want to ensure that the version number always matches the version of alpine you are trying to use.
Let me know how that works for you. If it doesn't resolve your issue, please paste the contents of your Dockerfile (and all related files, like repositories) in a Gist and link to that in a comment here. Thanks!
If they happen to be running Docker inside VirtualBox on Mac then they are likely running into the DNS proxy issue. See if https://github.com/boot2docker/boot2docker/issues/451#issuecomment-65432123 sounds like your issue.
@andyshinn I just saw the edit @trompx's comment; that makes a lot of sense. Good catch!
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
When you got the following error
WARNING: Ignoring APKINDEX.xxxx.tar.gz: No such file or directory
then there's a default note in the Alpine Linux wiki:
If you get WARNING: Ignoring APKINDEX.xxxx.tar.gz: No such file or directory while running package related tools, check your /etc/apk/repositories file if an entry points to .../v2.4/testing/. This directory is gone.
To check the content of the repositories file
cat /etc/apk/repositories
or
When you take a look at the Gliderlabs _Alpine Base Repo documentation_ here, then you will find exactly the same line as written above:
apk --update packagename
In case you want to add package repos, make sure you are not running on edge as those seem to be often behind, especially when you use community packages. Protip: Always go with …/latest-stable, instead of a repository url like v3.5 (when you are building upon alpine:latest), to make sure that your package repos are moving along without the need for updates and maintainence.
The same error can be the result of this docker issue:
https://github.com/docker/docker/issues/13381
I'm getting this error with rkt
This may or may not be related but I was getting this error when running docker on my Raspberry pi 3 and it turns out uverse was blocking my outgoing connection to the repo because "router behind router" protection was enabled on my gateway.
I just got same error. Repository changed to from http://dl-4.alpinelinux.org/ to http://dl-cdn.alpinelinux.org/. (image alpine:3.3)
Why isn't old DNS record pointed to new location?
@mishak87 Seeing this too
this issue is back
Why isn't Alpine linux's own repository in the repositories file? 😨
Adding this into the repositories worked for most of the stuff for me:
http://dl-5.alpinelinux.org/alpine/v3.3/main/
http://dl-6.alpinelinux.org/alpine/v3.3/main/
Still can't install iptables though.
I am suffering this issue with v3.4.Tried everything mentioned here,however, the only thing I can do is to download the packages I need and install it manually.
@rayyen @Skarlso @oryband ran into the same problem, my solution is simply add --no-cache flag and that works like a charm
Also an interesting nitpick is, that the doc says that the repository URL should point to the APK_INDEX.tar.gz, where as in reality, it's pointing to the main folder and x86_64 will be autoappended.
@Ehekatl , your solution works great ! thanks
alpine:/home/ray/laradock#` apk add docker --no-cache
fetch http://dl-4.alpinelinux.org/alpine/v3.4/main/x86_64/APKINDEX.tar.gz
fetch http://dl-6.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz
OK: 444 MiB in 61 packages
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.
@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
@wanjochan, @jasetom: https://docs.docker.com/v1.8/articles/networking/
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.
I just reboot ,it is solved. 😎
I fixed this issue by adding --dns 8.8.8.8 --dns 8.8.4.4 to my DOCKER_OPTS in /etc/default/docker and restarting docker.
this configuration works well for me:
RUN echo "http://dl-cdn.alpinelinux.org/alpine/v3.4/community" >> /etc/apk/repositories;
echo "http://dl-cdn.alpinelinux.org/alpine/v3.4/main" >> /etc/apk/repositories
Found that networking was down. Started it with:
service networking restart
I had this error. It was due to some invalid invisible characters
RUN apk add --no-cache --virtual build-deps \
make \
perl \ # <--- Non-space character in this line caused the error
gcc \
g++ \
git
...
Bleh.
Just fixed my issue by disabling my running openvpn instance. It seems to create a conflict with docker containers.
sudo service openvpn stop
Regards
dint Under stand the root cause of the issue
Just a docker pull worked. My image was too old...
/usr/src/app # cat /etc/apk/repositories
http://mirrors.ustc.edu.cn/alpine/v3.4/main
http://mirrors.ustc.edu.cn/alpine/v3.4/community
/usr/src/app # apk add --no-cache --virtual .build-deps python
fetch http://mirrors.ustc.edu.cn/alpine/v3.4/main/x86_64/APKINDEX.tar.gz
fetch http://mirrors.ustc.edu.cn/alpine/v3.4/community/x86_64/APKINDEX.tar.gz
(1/9) Installing libbz2 (1.0.6-r5)
(2/9) Installing libffi (3.2.1-r2)
(3/9) Installing gdbm (1.11-r1)
(4/9) Installing ncurses-terminfo-base (6.0_p20171125-r0)
(5/9) Installing ncurses-terminfo (6.0_p20171125-r0)
(6/9) Installing ncurses-libs (6.0_p20171125-r0)
(7/9) Installing readline (6.3.008-r4)
(8/9) Installing sqlite-libs (3.13.0-r1)
(9/9) Installing python (2.7.14-r0)
Executing busybox-1.24.2-r13.trigger
OK: 76 MiB in 31 packagesIt was the corporate proxy in my case :/
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 restart
And then it worked.
I had this issue using alpine:latest and trying to install openssh-client, using alpine:3.4 resolved it, didn't test with other repos, used 3.4 because that is what is in the example in readme. Didn't have to update repository sources.
I am facing this as well, some of the packages seem to fail to be installed and throw a Protocol Error on latest alpine, I tested and I notice that on alpine 3.7 it works fine for me however 3.8 and later give me this error. I tried playing around with changing dns, restarting docker (I am using docker for mac) and even factory reset my docker environment but none of those seem to help. Oddly however, I noticed that within my CI environment I did not face this issue, so it's something rather strange and I am unable to determine the root cause.
I am aslo new to alpine image I am facing this as well
my cat /etc/apk/repositories file contents are as below
http://dl-cdn.alpinelinux.org/alpine/v3.9/main
http://dl-cdn.alpinelinux.org/alpine/v3.9/community
alpine version is 3.9.3
can someone please suggest some solution
Thanks
@vkkothawale As of now the only solution I found was to downgrade to alpine version 3.4
@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 install chsh nor usermod - but I can install openssh without any issue 🤔
Already tried downgrading all the way down to 3.4 but still getting this error no matter what:
# apk add --no-cache chsh
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/community/x86_64/APKINDEX.tar.gz
ERROR: unsatisfiable constraints:
chsh (missing):
required by: world[chsh]
#
Same for usermod.
I've been scratching my head all day because of this problem. Turns out it was a rookie mistake, but thought I'd add my solution to the list in case it helps anyone...
I was getting:
`ERROR: unsatisfiable constraints:
py3-twisted (missing):
required by: world[py3-twisted]`
(py3-twisted is a new addition to Alpine 3.10)
In my dockerfile I was using FROM alpine:latest and expecting it to build from Alpine 3.10.
Thing is, Alpine:latest in my local image list was only 3.9.
docker pull alpine:latest upgraded the local alpine:latest to version 3.10 and it worked after that.
FROM alpine:3.7
RUN apk --update add tmux
I'm constantly getting this error, even just for apk --update, I've tried change version to
FROM alpine:3.10 does the same error :(
Step 9/13 : RUN apk --update add tmux
---> Running in bac04c27db8f
/bin/sh: 1: apk: not found
The command '/bin/sh -c apk --update add tmux' returned a non-zero code: 127
I was having this issue because I had "iptables":false option set in /etc/docker/daemon.json. Removed it, restarted docker, and the build worked as expected.
Most helpful comment
@rayyen @Skarlso @oryband ran into the same problem, my solution is simply add
--no-cacheflag and that works like a charm