Docker can not access the external port mapping problem

Check ip forwarding is turned on

sysctl net.ipv4.ip_forward

Net.ipv4.ip_forward = 0 indicates that the display is not open.

Open

/etc/sysctl.conf vim
# add a line
net.ipv4.ip_forward = 1
# ZZ Save the file the Shift
# sysctl -p reload
 

sysctl

sysctl kernel parameters in the configuration of the display / proc / sys directory. Can be set or reset sysctl networking capabilities, such as IP forwarding, IP source routing debris removal and inspection. Users only need to edit the /etc/sysctl.conf file, you can manually or automatically perform functions controlled by sysctl.

    Format:

    sysctl [-n] [-e] -w variable=value

    sysctl [-n] [-e] -p <filename> (default /etc/sysctl.conf)

    sysctl [-n] [-e] -a

    Meaning of commonly used parameters:

    -w temporarily change the value of a specified parameter, such as

         sysctl -w net.ipv4.ip_forward=1

    -a display all system parameters

    -p, if not specified in /etc/sysctl.conf that is loaded from the file is loaded from the specified system parameters
----------------
Disclaimer: This article is CSDN bloggers' cashZhang27 " the original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
Original link: https: //blog.csdn.net/m0_37726449/article/details/100073042

Guess you like

Origin www.cnblogs.com/hbzgyjh/p/12287118.html
Recommended