Got this docker command I want to run. Note the tail command at the end for keeping the container up and running.
docker run -d --name xxxyyyzzz-blah alpine /bin/ash -c "/usr/bin/tail
+-f /dev/null"
The following backtick operation runs this command with no issue and the container is detached from and the container is left still running:
use v5.38;
`docker run -d --name xxxyyyzzz-blah alpine /bin/ash -c "/usr/bin/tail
+ -f /dev/null"`;
However, with the IPC::Run3 module, the container gets set up, but the tail command never seems to get executed and the container exits immediately:
use v5.38;
use IPC::Run3;
my $cmd = [ 'docker', 'run', '-d', '--name', 'xxxyyyzzz-blah', 'alpine
+', '/bin/ash', '-c', '"/usr/bin/tail -f /dev/null"' ];
my ($out, $err);
my $success = run3($cmd, undef, \$out, \$err);
print $success; # prints 1
I tried breaking up the the last element into 3 different elements separated by spaces but that didn't help.
|
Returning data
5 direct replies — Read more / Contribute
|
by frank1
on Apr 20, 2024 at 15:46
|
({
"items": [
{
"title": "Valls"
},
{
"title": "AUT15605"
},
{
"title": "10UT15605"
}
]
})
Am getting this error with my code
Can't modify private hash in concatenation (.) or string
my $dbh = DBI->connect("DBI:mysql:$dbname:$host", $usr, $pwd, {
RaiseError => 1,
}) or die $DBI::errstr;
my $sth = $dbh->prepare("SELECT titles FROM tbl_1");
$sth->execute();
my $Data = $sth->fetchall_arrayref();
my %output;
foreach my $Data (@$Data) {
my ($title) = @$Data;
%output .= (
'items' => [("title" => "$title")]
);
}
my $results = to_json(\%output);
print "Content-type: text/html\n\n";
print $results;
|