RHEL / CentOS Linux 7 Enable Ping Access In Docker Container

To enable ping access in a Docker container on RHEL/CentOS Linux 7, you can use the following steps:

  1. Start a new Docker container:
docker run -it --name <container_name> <image_name> /bin/bash
  1. Install the iputils package inside the Docker container:
yum install iputils -y
  1. Modify the firewall rules to allow ICMP (ping) traffic:
firewall-cmd --permanent --zone=public --add-rich-rule='rule family="ipv4" source address="<container_ip_address>" accept'
firewall-cmd --reload
  1. Verify that ping access is enabled by pinging a remote host from inside the container:
ping <remote_host_ip_address>

Note: Replace <container_name>, <image_name>, <container_ip_address>, and <remote_host_ip_address> with the appropriate values for your environment.

Leave a Comment