Docker: Perl with I/O
examples/perl-io/Dockerfile
FROM ubuntu:20.04 COPY greetings.pl /opt/ CMD perl /opt/greetings.pl
examples/perl-io/greetings.pl
use 5.010; use strict; use warnings; print "What is your name? "; my $name = <STDIN>; chomp $name; say "Hello $name, how are you today?";
$ docker build -t mydocker .
We need to tell Docker that this is an interactive process
docker run -it --rm mydocker What is your name? Foo Hello Foo, how are you today?