【发布时间】:2021-01-05 11:30:15
【问题描述】:
我是 Docker 和 Perl 的新手。 我想 dockerize 我的 perl 应用程序,但在运行时出现以下错误:
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,但没有任何效果。有人可以帮帮我吗?
【问题讨论】:
-
可能需要查看一些代码。
-
我假设您检查了 /opt/deploy/bin/deploy、/opt 和 /opt/deploy 存在并且具有正确的权限?
-
@TLP 你能快速告诉如何在 docker 环境中进行操作吗?
-
@TLP 我检查了它,但 /opt/deploy/bin/deploy 在没有目录这是我运行的脚本
-
您没有显示令牌数组的设置。错误很可能是token指定的命令行无法执行,因为该命令不存在
标签: docker perl ubuntu io cpan