Net::OpenSSHを入れるまでの手順。
Dockerfile
FROM centos:centos7.4.1708
RUN yum -y install epel-release freerdp git nkf tmux telnet telnet-server vsftpd ftp tftp-server xinetd xrdp tigervnc-server expect* *expect* cpan *YAML* libyaml-devel iptables-services dovecot cyrus-sasl cyrus-sasl-* gmp-devel
RUN yum -y groupinstall 'Development tools'
RUN yum -y install "perl(Math::GMP)"
RUN yum -y install "perl(File::HomeDir)"
##### Add
RUN rm -f /root/.cpan/CPAN/MyConfig.pm
ADD MyConfig.pm /root/.cpan/CPAN/MyConfig.pm
RUN cat /root/.cpan/CPAN/MyConfig.pm
##### cpan
RUN cpan install Net::Telnet
RUN cpan install Expect
RUN cpan install Net::SSH
RUN cpan install Net::SSH::Perl
RUN cpan install Net::OpenSSH
一旦、手動で設定して作成したものをコピーした
MyConfig.pm
$CPAN::Config = {
'applypatch' => q[],
'auto_commit' => q[0],
'build_cache' => q[100],
'build_dir' => q[/root/.cpan/build],
'build_dir_reuse' => q[0],
'build_requires_install_policy' => q[yes],
'bzip2' => q[/usr/bin/bzip2],
'cache_metadata' => q[1],
'check_sigs' => q[0],
'colorize_output' => q[0],
'commandnumber_in_prompt' => q[1],
'connect_to_internet_ok' => q[1],
'cpan_home' => q[/root/.cpan],
'ftp_passive' => q[1],
'ftp_proxy' => q[プロキシがあれば記入],
'getcwd' => q[cwd],
'gpg' => q[/usr/bin/gpg],
'gzip' => q[/usr/bin/gzip],
'halt_on_failure' => q[0],
'histfile' => q[/root/.cpan/histfile],
'histsize' => q[100],
'http_proxy' => q[プロキシがあれば記入],
'inactivity_timeout' => q[0],
'index_expire' => q[1],
'inhibit_startup_message' => q[0],
'keep_source_where' => q[/root/.cpan/sources],
'load_module_verbosity' => q[none],
'make' => q[/usr/bin/make],
'make_arg' => q[],
'make_install_arg' => q[],
'make_install_make_command' => q[/usr/bin/make],
'makepl_arg' => q[],
'mbuild_arg' => q[],
'mbuild_install_arg' => q[],
'mbuild_install_build_command' => q[./Build],
'mbuildpl_arg' => q[],
'no_proxy' => q[],
'pager' => q[/usr/bin/less],
'patch' => q[/usr/bin/patch],
'perl5lib_verbosity' => q[none],
'prefer_external_tar' => q[1],
'prefer_installer' => q[MB],
'prefs_dir' => q[/root/.cpan/prefs],
'prerequisites_policy' => q[follow],
'proxy_pass' => q[プロキシがあれば記入],
'proxy_user' => q[プロキシがあれば記入],
'scan_cache' => q[atstart],
'shell' => undef,
'show_unparsable_versions' => q[0],
'show_upload_date' => q[0],
'show_zero_versions' => q[0],
'tar' => q[/usr/bin/tar],
'tar_verbosity' => q[none],
'term_is_latin' => q[1],
'term_ornaments' => q[1],
'test_report' => q[0],
'trust_test_report_history' => q[0],
'unzip' => q[/usr/bin/unzip],
'urllist' => [q[http://cpan.metacpan.org/], q[http://cpan.metacpan.org/], q[ftp://ftp.jaist.ac.jp/pub/CPAN/], q[ftp://ftp.kddilabs.jp/CPAN/], q[ftp://ftp.nara.wide.ad.jp/pub/CPAN/], q[ftp://ftp.riken.jp/lang/CPAN/], q[ftp://ftp.yz.yamagata-u.ac.jp/pub/lang/cpan/], q[ftp://mirror.jre655.com/CPAN/], q[http://ftp.jaist.ac.jp/pub/CPAN/], q[http://ftp.nara.wide.ad.jp/pub/CPAN/], q[http://ftp.riken.jp/lang/CPAN/], q[http://ftp.yz.yamagata-u.ac.jp/pub/lang/cpan/], q[http://mirror.jre655.com/CPAN/]],
'use_sqlite' => q[0],
'version_timeout' => q[15],
'wget' => q[/usr/bin/wget],
'yaml_load_code' => q[0],
'yaml_module' => q[YAML],
};
1;
__END__