Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker build error: failed to add the host

I'm facing an unexpected error when running docker build, and I say unexpected because I haven't changed my Dockerfile for a while, and it had worked fine for the last time two weeks ago, but now I'm getting the following error:

failed to create endpoint optimistic_spence on network bridge: failed to add the host (veth9fc3a03) <=> sandbox (veth15abfd6) pair interfaces: operation not supported

In case it is of any help:

  • Docker version is 18.06.0-ce, build 0ffa8257ec
  • I don't see any container with docker ps
  • Systemd returns an active status for the docker process (sudo systemctl status docker)
  • Build command is: docker build -t user/repo:tag .

Dockerfile looks like:

FROM alpine:3.4

LABEL version="current version"
LABEL description="A nice description."
LABEL maintainer="[email protected]"

RUN apk update && apk add \
    gcc \
    g++ \
    make \
    git \
    && git clone https://gitlab.com/user/repo.git \
    && cd repo \
    && make \
    && cp program /bin \
    && rm -r /repo \
    && apk del g++ make git

WORKDIR /tmp

ENTRYPOINT ["program"]

Does anybody understand what is going on? Thank you!

EDIT When combined with the --network option, the error changes a little, but it won't fix the problem. For example, --network=host gives the following:

fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/main/x86_64/APKINDEX.tar.gz

ERROR: http://dl-cdn.alpinelinux.org/alpine/v3.4/main: temporary error (try again later)

WARNING: Ignoring APKINDEX.167438ca.tar.gz: No such file or directory

fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/community/x86_64/APKINDEX.tar.gz

ERROR: http://dl-cdn.alpinelinux.org/alpine/v3.4/community: temporary error (try again later)

WARNING: Ignoring APKINDEX.a2e6dac0.tar.gz: No such file or directory 2 errors; 11 distinct packages available

The command '/bin/sh -c apk update && apk add gcc g++ make git && git clone https://gitlab.com/user/repo.git && cd repo && make && cp program /bin && rm -r /repo && apk del g++ make git' returned a non-zero code: 2

like image 436
elcortegano Avatar asked Mar 22 '26 01:03

elcortegano


1 Answers

Had the same error and systemctl restart docker nor pruning og images & system did not do it for me, I ended up rebooting my computer which seems o have resolved the issue.

like image 141
Testix Avatar answered Mar 23 '26 23:03

Testix



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!