<p>We had a similar case, where an image doesn't build and had been raising the issue above (while it worked on other machines) we had put a lot of time and efforts to upgrade Docker (on Ubuntu 18.04), clean up all images, volumes ...try many staff to debug, but as crazy as it sounds, after just explicitly restarting the docker service, it has resolved itself. (I wouldn't be able to explain what happened exactly)</p>

<p>So always first try the old "have you(I) turned it on and off again (explicitly)"!</p>

<p>btw before purging images.., at the all beginning have had a different message (it was complaining about access to some Python packages permission).</p>

CC BY-SA 4.0
2020-05-26T19:24:25.110Z
2020-05-26T19:24:25.110Z
mou55
<p>It may help to try it on another computer or inside a VM to isolate the cause.</p>
<p>I ran into the same issue on one computer (stable Manjaro with snap docker). Interestingly, I was able to build the same Dockerfile without issues on another computer (running KDE Neon with snap docker). I'm not sure what the actual cause of the issue is, but it seems, in my case, to be a problem with docker itself and not the Dockerfile.</p>
<a href="https://github.com/mlaradji/redis-cluster-docker-swarm/blob/master/redis-sentinel/Dockerfile" rel="nofollow noreferrer">Dockerfile</a>:
<pre><code>FROM redis:5.0.9-alpine

LABEL version=&quot;1.0.4&quot;

ENV SENTINEL_QUORUM=2 \
    SENTINEL_DOWN_AFTER=1000 \
    SENTINEL_FAILOVER=1000 \
    REDIS_MASTER_NAME=redismaster \
    REDIS_MASTER=redis-zero \
    REDIS_SENTINEL_NAME=redis-sentinel

RUN apk --no-cache add drill
[...]
</code></pre>
Output:
<pre class="lang-sh prettyprint-override"><code>ERROR: Unable to read database state: No such file or directory
ERROR: Failed to open apk database: No such file or directory
The command '/bin/sh -c apk --no-cache add drill' returned a non-zero code: 99
</code></pre>

CC BY-SA 4.0
2020-04-24T06:09:26.673Z
2020-04-24T06:09:26.673Z
2020-06-18T08:28:10.803Z
Mohamed Laradji
<p>Please try splitting this line:</p>

<p><code>RUN apk add git &amp;&amp; git clone https://github.com/s0md3v/Photon.git Photon</code></p>

<p>into two:</p>

<pre><code>RUN apk add git

RUN git clone https://github.com/s0md3v/Photon.git Photon
</code></pre>

<p>This will tell you exactly which piece of the command fails. If it is the <code>apk add git</code> part maybe try this: <code>RUN apk update &amp;&amp; apk add git</code>.</p>

<p>Also you may fixing to a specific tag in the <code>FROM python:3-alpine</code> as <code>3-alpine</code> follows the latest alpine release which may have some unknown/unfixed issues.</p>

<p>See <a href="https://hub.docker.com/_/python/" rel="nofollow noreferrer">https://hub.docker.com/_/python/</a> for available tags.</p>

CC BY-SA 4.0
2019-11-27T22:35:42.237Z
2019-11-27T22:35:42.237Z
luki
<p>I was getting this error in the Docker installation that installed using &quot;snap&quot; in Ubuntu 18.04. My problem was resolved when I uninstalled Docker and installed it as in their official documentation.</p>
<p>To uninstall Docker (snap): <a href="https://askubuntu.com/a/1155962/1063090">https://askubuntu.com/a/1155962/1063090</a> <br/>
Docker official installation: <a href="https://docs.docker.com/engine/install/ubuntu/" rel="nofollow noreferrer">https://docs.docker.com/engine/install/ubuntu/</a></p>

CC BY-SA 4.0
2020-09-11T19:14:22.337Z
2020-09-12T15:54:08.657Z
2020-09-12T15:54:08.657Z
Mehmet Ali Peker
<p>I was trying to install <a href="https://github.com/s0md3v/Photon" rel="noreferrer">Photon</a> by pulling the docker image. But when I run <code>docker build -t photon .</code> I am getting the below error.</p>

<pre><code> ---&gt; Running in 3076fb42ef8b
ERROR: Unable to read database state: No such file or directory
ERROR: Failed to open apk database: No such file or directory
The command '/bin/sh -c apk add git &amp;&amp; git clone https://github.com/s0md3v/Photon.git Photon' returned a non-zero code: 99
</code></pre>

<p>I observed the same error before when I tried to install some other application. So, I am guessing this is not something specific to Photon. What is causing this error? How to fix this?</p>

CC BY-SA 4.0
2019-11-27T18:18:54.383Z
Did you create an issue on their GitHub?
030
<docker><containers><alpine>
ERROR: Unable to read database state: No such file or directory
Anonymous Platypus
# ERROR: Unable to read database state: No such file or directory

(Asked by: username_0 on 2019-11-27)

I was trying to install Photon by pulling the docker image. But when I run docker build -t photon . I am getting the below error.
 ---> Running in 3076fb42ef8b
ERROR: Unable to read database state: No such file or directory
ERROR: Failed to open apk database: No such file or directory
The command '/bin/sh -c apk add git && git clone https://github.com/s0md3v/Photon.git Photon' returned a non-zero code: 99

I observed the same error before when I tried to install some other application. So, I am guessing this is not something specific to Photon. What is causing this error? How to fix this?

**Tags:** docker, containers, alpine

> **Comments:**
> **username_1**: Did you create an issue on their GitHub?  

---

## 4 answers

### Answer by username_2 on 2020-05-26. Score: 0

We had a similar case, where an image doesn't build and had been raising the issue above (while it worked on other machines) we had put a lot of time and efforts to upgrade Docker (on Ubuntu 18.04), clean up all images, volumes ...try many staff to debug, but as crazy as it sounds, after just explicitly restarting the docker service, it has resolved itself. (I wouldn't be able to explain what happened exactly)

So always first try the old "have you(I) turned it on and off again (explicitly)"!

btw before purging images.., at the all beginning have had a different message (it was complaining about access to some Python packages permission).


---

### Answer by username_3 on 2020-04-24. Score: 0

It may help to try it on another computer or inside a VM to isolate the cause.
I ran into the same issue on one computer (stable Manjaro with snap docker). Interestingly, I was able to build the same Dockerfile without issues on another computer (running KDE Neon with snap docker). I'm not sure what the actual cause of the issue is, but it seems, in my case, to be a problem with docker itself and not the Dockerfile.
Dockerfile:
FROM redis:5.0.9-alpine

LABEL version="1.0.4"

ENV SENTINEL_QUORUM=2 \
    SENTINEL_DOWN_AFTER=1000 \
    SENTINEL_FAILOVER=1000 \
    REDIS_MASTER_NAME=redismaster \
    REDIS_MASTER=redis-zero \
    REDIS_SENTINEL_NAME=redis-sentinel

RUN apk --no-cache add drill
[...]

Output:
ERROR: Unable to read database state: No such file or directory
ERROR: Failed to open apk database: No such file or directory
The command '/bin/sh -c apk --no-cache add drill' returned a non-zero code: 99


---

### Answer by username_4 on 2019-11-27. Score: 0

Please try splitting this line:
RUN apk add git && git clone https://github.com/s0md3v/Photon.git Photon
into two:
RUN apk add git

RUN git clone https://github.com/s0md3v/Photon.git Photon

This will tell you exactly which piece of the command fails. If it is the apk add git part maybe try this: RUN apk update && apk add git.
Also you may fixing to a specific tag in the FROM python:3-alpine as 3-alpine follows the latest alpine release which may have some unknown/unfixed issues.
See https://hub.docker.com/_/python/ for available tags.


---

### Answer by username_5 on 2020-09-11. Score: 0

I was getting this error in the Docker installation that installed using "snap" in Ubuntu 18.04. My problem was resolved when I uninstalled Docker and installed it as in their official documentation.

To uninstall Docker (snap): <https://askubuntu.com/a/1155962/1063090>   
Docker official installation: <https://docs.docker.com/engine/install/ubuntu/>


---

