1 #!/bin/sh /etc/rc.common
4 DOCKERD_CONF
="/etc/docker/daemon.json"
7 config_get daemon_ea
"local" daemon_ea
9 init_dockerman_chain
(){
10 iptables
-N DOCKER-MAN
>/dev
/null
2>&1
11 iptables
-F DOCKER-MAN
>/dev
/null
2>&1
12 iptables
-D DOCKER-USER
-j DOCKER-MAN
>/dev
/null
2>&1
13 iptables
-I DOCKER-USER
-j DOCKER-MAN
>/dev
/null
2>&1
16 add_allowed_interface
(){
17 iptables
-A DOCKER-MAN
-i $1 -o docker0
-j RETURN
21 iptables
-A DOCKER-MAN
-d $1 -o docker0
-j RETURN
24 handle_allowed_interface
(){
25 #config_list_foreach "local" allowed_ip add_allowed_ip
26 config_list_foreach
"local" ac_allowed_interface add_allowed_interface
27 iptables
-A DOCKER-MAN
-m conntrack
--ctstate ESTABLISHED
,RELATED
-o docker0
-j RETURN
>/dev
/null
2>&1
28 iptables
-A DOCKER-MAN
-m conntrack
--ctstate NEW
,INVALID
-o docker0
-j DROP
>/dev
/null
2>&1
29 iptables
-A DOCKER-MAN
-j RETURN
>/dev
/null
2>&1
33 [ ! -x "/etc/init.d/dockerd" ] && return 0
35 if [ -n "$daemon_ea" ]; then
36 handle_allowed_interface
37 lua
/usr
/share
/dockerman
/dockerd-config.lua
"$DOCKERD_CONF" && /etc
/init.d
/dockerd restart
&& sleep 5 ||
{
38 # 1 running, 0 stopped
39 STATE
=$
([ -n "$(ps |grep /usr/bin/dockerd | grep -v grep)" ] && echo 1 ||
echo 0)
40 [ "$STATE" == "0" ] && /etc
/init.d
/dockerd start
&& sleep 5
42 lua
/usr
/share
/dockerman
/dockerd-ac.lua
44 /etc
/init.d
/dockerd stop