Failed to build docker image with warning message "IPv4 forwarding is disabled. Networking will not work"

Photo by Milan De Clercq on Unsplash

Failed to build docker image with warning message "IPv4 forwarding is disabled. Networking will not work"

Ada Cheng's photo
Ada Cheng
·Sep 12, 2022·

1 min read

Table of contents

  • Problem
  • Solution

Problem

Step 3/12 : RUN apk add openjdk11
 ---> [Warning] IPv4 forwarding is disabled. Networking will not work.
 ---> Running in 0f20ee3ab3eb
fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/main/x86_64/APKINDEX.tar.gz
ERROR: https://dl-cdn.alpinelinux.org/alpine/v3.16/main: temporary error (try again later)
WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.16/main: No such file or directory
fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/community/x86_64/APKINDEX.tar.gz
ERROR: https://dl-cdn.alpinelinux.org/alpine/v3.16/community: temporary error (try again later)
WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.16/community: No such file or directory
ERROR: unable to select packages:
  openjdk11 (no such package):
    required by: world[openjdk11]
The command '/bin/sh -c apk add openjdk11' returned a non-zero code: 1

Solution

  • Update configuration

    sysctl -w net.ipv4.ip_forward=1
    
  • Read configuration

    sysctl net.ipv4.ip_forward
    
 
Share this