Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Docker: Perl with I/O

FROM ubuntu:20.04
COPY greetings.pl /opt/
CMD  perl /opt/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?