Bash 容器内的docker卷曲插座

Bash 容器内的docker卷曲插座,bash,docker,curl,libtorrent,Bash,Docker,Curl,Libtorrent,我有一个rtorrent的bash后处理脚本。 在其中,我尝试创建一个容器,启动它,最后将其移除。 所有这些都通过curl命令发送到docker套接字,我将其安装到容器中。 该命令已从rtorrent成功执行。pushover的curl命令运行良好 但是我得到了一个curl:(7)无法连接到docker curl命令的服务器错误消息 希望有人能给我指出正确的方向 日志: ^@ --- ^@/usr/local/bin/rtorrent-postprocess.sh /Pathtothedownl

我有一个rtorrent的bash后处理脚本。 在其中,我尝试创建一个容器,启动它,最后将其移除。 所有这些都通过curl命令发送到docker套接字,我将其安装到容器中。 该命令已从rtorrent成功执行。pushover的curl命令运行良好

但是我得到了一个curl:(7)无法连接到docker curl命令的服务器错误消息

希望有人能给我指出正确的方向

日志:

^@
---
^@/usr/local/bin/rtorrent-postprocess.sh /Pathtothedownload Nameofthedownload label
---
^@{"status":1,"request":"ec5c3c9c-5744-48f4-909b-68d38ec5e659"}curl: (7) Couldn't connect to server
curl: (7) Couldn't connect to server
curl: (7) Couldn't connect to server
curl: (7) Couldn't connect to server

--- Success ---
#!/bin/bash
# rtorrent postprocess Script by Tobias
export LANG=de_DE.UTF-8

# The file for logging events from this script
LOGFILE="/config/rtorrent-postprocess.log"
#LOGFILE="./debug.log"

# Pfad des Downloads
FOLDER="$1"

# Name des Downloads
NAME="$2"

# Label des Downloads
LABEL="$3"

# Media Verzeichniss /data/Media
MEDIA="/data/Media"

# COMPLETE Verzeichniss mit label /data/torrent/completed/$3
COMPLETE="/data/torrent/completed/$3"

##############################################################################

function edate
{
  echo "`date '+%Y-%m-%d %H:%M:%S'`    $1" >> "$LOGFILE"
}

function pushover {
  curl -s \
    -F "token=xxxxxxxxxxxxxxxx" \
    -F "user=xxxxxxxxxxxxxxxxx" \
    -F "message=$1 finished $2 $3 on `date +%d.%m.%y-%H:%m`" \
    https://api.pushover.net/1/messages.json
}

edate " "
edate "Verzeichniss ist $COMPLETE"
edate "Name ist $NAME"
edate "Label ist $LABEL"
edate "rtorrent finished downloading $NAME"

pushover "rtorrent" "downloading" "$NAME"

edate "Starte Filebot - $COMPLETE/$NAME"

test_command() {
        curl --unix-socket /var/run/docker.sock -X POST "http://localhost/containers/${NAME}/wait" -H "accept: application/json"
}

curl --unix-socket /var/run/docker.sock -H "Content-Type: application/json" -d '{ "Image": "rednoah/filebot", "Cmd": ["-script", "fn:amc", "--output", "/Media", "--action", "move", "-non-strict", "/volume1", "--log-file", "/opt/rtorrentvpn/config/filebot.log", "--conflict", "auto", "--def", "artwork=n", "seriesFormat=Serien/{localize.eng.n}/Season {s.pad(2)}/{localize.eng.n} - {s00e00} - {localize.deu.t}", "movieFormat=Filme/{localize.deu.n} ({y})/{localize.deu.n} ({y})", "musicFormat=Musik/{artist}/{album}/{fn}"], "HostConfig": { "Binds": ["'$COMPLETE/$NAME':/volume1", "data:/data", "/data/Media:/Media"]} }' "http://localhost/containers/create?name=${NAME}"

curl --unix-socket /var/run/docker.sock -X POST "http://localhost/containers/${NAME}/start" -H "accept: application/json"

if [ "$(test_command)" == "200" ]; then
    edate "Status ist $test_command"
fi

curl --unix-socket /var/run/docker.sock -X DELETE "http://localhost/containers/${NAME}?force=true?v=true" -H "accept: application/json"

edate " "
edate "Filebot fertig"
脚本:

^@
---
^@/usr/local/bin/rtorrent-postprocess.sh /Pathtothedownload Nameofthedownload label
---
^@{"status":1,"request":"ec5c3c9c-5744-48f4-909b-68d38ec5e659"}curl: (7) Couldn't connect to server
curl: (7) Couldn't connect to server
curl: (7) Couldn't connect to server
curl: (7) Couldn't connect to server

--- Success ---
#!/bin/bash
# rtorrent postprocess Script by Tobias
export LANG=de_DE.UTF-8

# The file for logging events from this script
LOGFILE="/config/rtorrent-postprocess.log"
#LOGFILE="./debug.log"

# Pfad des Downloads
FOLDER="$1"

# Name des Downloads
NAME="$2"

# Label des Downloads
LABEL="$3"

# Media Verzeichniss /data/Media
MEDIA="/data/Media"

# COMPLETE Verzeichniss mit label /data/torrent/completed/$3
COMPLETE="/data/torrent/completed/$3"

##############################################################################

function edate
{
  echo "`date '+%Y-%m-%d %H:%M:%S'`    $1" >> "$LOGFILE"
}

function pushover {
  curl -s \
    -F "token=xxxxxxxxxxxxxxxx" \
    -F "user=xxxxxxxxxxxxxxxxx" \
    -F "message=$1 finished $2 $3 on `date +%d.%m.%y-%H:%m`" \
    https://api.pushover.net/1/messages.json
}

edate " "
edate "Verzeichniss ist $COMPLETE"
edate "Name ist $NAME"
edate "Label ist $LABEL"
edate "rtorrent finished downloading $NAME"

pushover "rtorrent" "downloading" "$NAME"

edate "Starte Filebot - $COMPLETE/$NAME"

test_command() {
        curl --unix-socket /var/run/docker.sock -X POST "http://localhost/containers/${NAME}/wait" -H "accept: application/json"
}

curl --unix-socket /var/run/docker.sock -H "Content-Type: application/json" -d '{ "Image": "rednoah/filebot", "Cmd": ["-script", "fn:amc", "--output", "/Media", "--action", "move", "-non-strict", "/volume1", "--log-file", "/opt/rtorrentvpn/config/filebot.log", "--conflict", "auto", "--def", "artwork=n", "seriesFormat=Serien/{localize.eng.n}/Season {s.pad(2)}/{localize.eng.n} - {s00e00} - {localize.deu.t}", "movieFormat=Filme/{localize.deu.n} ({y})/{localize.deu.n} ({y})", "musicFormat=Musik/{artist}/{album}/{fn}"], "HostConfig": { "Binds": ["'$COMPLETE/$NAME':/volume1", "data:/data", "/data/Media:/Media"]} }' "http://localhost/containers/create?name=${NAME}"

curl --unix-socket /var/run/docker.sock -X POST "http://localhost/containers/${NAME}/start" -H "accept: application/json"

if [ "$(test_command)" == "200" ]; then
    edate "Status ist $test_command"
fi

curl --unix-socket /var/run/docker.sock -X DELETE "http://localhost/containers/${NAME}?force=true?v=true" -H "accept: application/json"

edate " "
edate "Filebot fertig"

我将PUID和GUID更改为根id。感谢的。现在一切都按预期运行。

docker.sock通常只能由
root:docker
写入。您是否检查了执行用户的文件权限和组成员资格?