title: Service 'web' failed to build with Protocol error
body: <p>I am trying to use postgresql in the docker container. However, i get an error </p>
  
  <blockquote>
    <p>Service 'web' failed to build: The command '/bin/sh -c apk add
    --update --no-cache --virtual .tmp-build-deps gcc libc-dev linux-headers postgresql-dev musl-dev zlib zlib-dev' returned a
    non-zero code: 4</p>
  </blockquote>
  
  <p>I get other related issue like ERROR: mpfr3-3.1.5-r1: Protocol error.</p>
  
  <p>Here is the screenshot of an issue as well as this might be related to each other</p>
  
  <p><a href="https://i.stack.imgur.com/sW7O4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sW7O4.png" alt="enter image description here"></a></p>
  
  <p>here is the code</p>
  
  <p>Dockerfile</p>
  
  <pre><code>FROM python:3.7-alpine
  
  ENV PYTHONUNBUFFERED 1
  ENV PYTHONDONTWRITEBYTECODE 1
  
  # set working directory which will be inside ubuntu
  WORKDIR /code
  
  #### Install a dependency ####
  # Copies new files and resources to the image's filesystems
  RUN pip3 install pipenv
  COPY Pipfile Pipfile.lock /code/
  RUN apk add --update --no-cache postgresql-client jpeg-dev
  RUN apk add --update --no-cache --virtual .tmp-build-deps \
      gcc libc-dev linux-headers postgresql-dev musl-dev zlib zlib-dev
  RUN pipenv install --system
  RUN apk del .tmp-build-deps
  COPY . /code/
  
  RUN adduser -D user
  USER user
  </code></pre>
  
  <p>docker-compose.yml</p>
  
  <pre><code>version: "3.7"
  
  services:
    db:
      image: postgres:12-alpine
      environment:
        - POSTGRES_DB=database
        - POSTGRES_USER=admin
        - POSTGRES_PASSWORD=admin123
    web:
      build: .
      command: &gt;
        sh -c "python /code/manage.py wait_for_db &amp;&amp;
               python /code/manage.py runserver 0.0.0.0:8000"
      environment:
        - DB_HOST=db
        - DB_NAME=database
        - DB_USER=admin
        - DB_PASS=admin123
      volumes:
        - .:/code
      # lets us map our port 8000 to the port 8000 in the Docker container
      ports:
        - 8000:8000
      # it says that we should run the db first before running our web services
      depends_on:
        - db
  </code></pre>