nysus has asked for the wisdom of the Perl Monks concerning the following question:
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.
$PM = "Perl Monk's";
$MC = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest Vicar Parson";
$nysus = $PM . ' ' . $MC;
Click here if you love Perl Monks
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: IPC::Run3 not working as expected when running Docker command
by nysus (Parson) on Apr 22, 2024 at 20:05 UTC | |
Re: IPC::Run3 not working as expected when running Docker command
by NERDVANA (Priest) on Apr 23, 2024 at 19:23 UTC |