I would reword your question I am not able to get internet inside container and look into similar ones.
Some suggestions you might try are:
service docker restart
and
pkill docker
iptables -t nat -F
ifconfig docker0 down
brctl delbr docker0
docker -d
UPDATE: Since you later specified you are using lxc, I'd search for "no internet connection inside lxc containers". For another user (who posted his config in greater detailed, see here) it was a firewall issue. He had to add:
-A FORWARD -s 10.0.3.0/24 -o eth0 -j ACCEPT
-A FORWARD -d 10.0.3.0/24 -o lxcbr0 -j ACCEPT
UPDATE: I setup a CentOS 7 system just to test this, and was able to create a CentOS lxc container inside it effortlessly following these instructions. It has external connectivity without any need to tweak the config.
yum install epel-release
yum install debootstrap perl libvirt
yum install lxc lxc-templates
systemctl start lxc.service
systemctl start libvirtd
lxc-create -n <name> -t centos
lxc-start -n <name>
yum install epel-release
yum -y install nodejs
Here is the resulting network config inside the container:
ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
5: eth0@if6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP qlen 1000
link/ether fe:9d:63:f7:72:ec brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 192.168.122.153/24 brd 192.168.122.255 scope global dynamic eth0
valid_lft 3437sec preferred_lft 3437sec
inet6 fe80::fc9d:63ff:fef7:72ec/64 scope link
valid_lft forever preferred_lft forever
cat /etc/resolv.conf
; generated by /usr/sbin/dhclient-script
nameserver 192.168.122.1
ip route
default via 192.168.122.1 dev eth0
169.254.0.0/16 dev eth0 scope link metric 1005
192.168.122.0/24 dev eth0 proto kernel scope link src 192.168.122.153
iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
If your lxc container is different from mine, please point out the differences; otherwise, the problem more likely lies in the host machine configuration. To know whether it's the firewall I would allow all traffic (temporarily relying on an external firewall) and check again. Also, make sure you have the forwarding rules mentioned earlier. On my CentOS host I found the following IPTABLES entries that were automatically created:
Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT all -- 0.0.0.0/0 192.168.122.0/24 ctstate RELATED,ESTABLISHED
ACCEPT all -- 192.168.122.0/24 0.0.0.0/0