Skip to content

Commit

Permalink
newcontainer: fix exposed ports issues
Browse files Browse the repository at this point in the history
  • Loading branch information
lisaac committed Jun 7, 2021
1 parent b4df3cc commit aa10688
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ if cmd_line and cmd_line:match("^DOCKERCLI.+") then
elseif cmd_line and cmd_line:match("^duplicate/[^/]+$") then
local container_id = cmd_line:match("^duplicate/(.+)")
create_body = dk:containers_duplicate_config({id = container_id}) or {}
luci.util.perror(luci.jsonc.stringify(create_body))
if not create_body.HostConfig then create_body.HostConfig = {} end
if next(create_body) ~= nil then
default_config.name = nil
Expand Down Expand Up @@ -203,7 +204,9 @@ elseif cmd_line and cmd_line:match("^duplicate/[^/]+$") then
if create_body.HostConfig.PortBindings and type(create_body.HostConfig.PortBindings) == "table" then
default_config.publish = {}
for k, v in pairs(create_body.HostConfig.PortBindings) do
table.insert( default_config.publish, v[1].HostPort..":"..k:match("^(%d+)/.+").."/"..k:match("^%d+/(.+)") )
for x, y in ipairs(v) do
table.insert( default_config.publish, y.HostPort..":"..k:match("^(%d+)/.+").."/"..k:match("^%d+/(.+)") )
end
end
end

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/bin/sh

[ -x "$(which dockerd)" ] && chmod +x /etc/init.d/dockerman && /etc/init.d/dockerman enable >/dev/null 2>&1
sed -i 's/self:cfgvalue(section) or {}/self:cfgvalue(section) or self.default or {}/' /usr/lib/lua/luci/view/cbi/dynlist.htm
/etc/init.d/uhttpd restart >/dev/null 2>&1
rm -fr /tmp/luci-indexcache /tmp/luci-modulecache >/dev/null 2>&1
touch /etc/config/dockerd
uci -q batch <<-EOF >/dev/null
set uhttpd.main.script_timeout="3600"
Expand All @@ -18,8 +22,4 @@ uci -q batch <<-EOF >/dev/null
set dockerd.dockerman.daemon_log_level='warn'
commit dockerd
EOF
[ -x "$(which dockerd)" ] && chmod +x /etc/init.d/dockerman && /etc/init.d/dockerman enable >/dev/null 2>&1
sed -i 's/self:cfgvalue(section) or {}/self:cfgvalue(section) or self.default or {}/' /usr/lib/lua/luci/view/cbi/dynlist.htm
/etc/init.d/uhttpd restart >/dev/null 2>&1
rm -fr /tmp/luci-indexcache /tmp/luci-modulecache >/dev/null 2>&1
exit 0

0 comments on commit aa10688

Please sign in to comment.