错误:IO :: Pipe:无法执行:没有这样的文件或目录

问题描述

我是Docker和Perl的新手。 我想对我的perl应用程序进行dockerize,但是在运行时出现以下错误

Error: IO::Pipe: Cannot exec: No such file or directory

这是我的Dockerfile:

FROM ubuntu:18.04
RUN apt-get update && \
    apt-get upgrade -y && \
    apt-get install -y libimage-magick-perl && \
    apt install -y make && \
    apt install -y gcc && \
    apt install -y perl && \
    apt install -y cpanminus
   
RUN cpan install YAML
RUN cpan install IPC::Run
    
workdir /opt
copY . /opt/deploy

ENTRYPOINT ["perl","/opt/deploy/bin/deploy"]

这是我使用IO :: Pipe模块的文件

package Deployment::Log::File;

use strict;
use warnings;

use base 'Tie::Handle';

use constant TRUE  => (1 == 1);
use constant FALSE => (0 == 1);

use Fcntl qw(:flock);
use IO::File;
use IO::Pipe;
use Symbol;
use Sys::Hostname;
use Text::ParseWords;
use Time::HiRes;

...
my $class       = shift;  $class = ref($class) if ref($class);
my $destination = shift;
my $layout      = shift;

my $handle;

if ($destination =~ s/^\s*\|\s*//) {
  my @token = map { $class->interpolate($_) } Text::ParseWords::shellwords($destination);

$handle = IO::Pipe->new;
$handle->writer(@token)
  or return undef;

我尝试使用cpan和cpanm安装IO :: Pipe和IO,但没有任何效果。有人可以帮我吗?

解决方法

$token[0]应该包含要运行的程序的名称。它可以是路径,也可以是简单的文件名(内核使用PATH env var将其解析为路径)。

您提供了一个简单的文件名,而在PATH env var指定的任何目录中都找不到具有该名称的可执行文件,或者您提供了一个不存在的文件的路径。

也许程序对当前工作目录做出了错误的假设?