MrFronk MrFronk - 5 months ago 83
Perl Question

Set the Perl environment correctly in dockerfile



I'm trying to build a dockerfile based on Centos 7 which can run a specific version of VEP (Variant Effect Predictor) which is written in Perl and has Perl dependencies which should be handled by running

perl INSTALL.pl
.

This isn't working for me and I need some help.

I was quite confident that I had installed all of the dependencies, yet if I run the install program it tells me that it cannot see them.

updated Dockerfile:

# Pull base image of centos.
FROM centos:7.3.1611

# install basics
RUN yum -y update && yum -y install wget \
gcc \
gcc-c++ \
kernel-devel \
make \
mlocate \
sudo \
curl \
rsync \
tar \
perl \
perl-core \
ansible \
git \
net-tools \
which \
cpan \
libcurl-devel \
python-devel \
texlive-lastpage \
texlive-misc.noarch \
texlive \
man \
epel-release \
ncurses-devel \
zlib-devel \
texinfo \
gtk+-devel \
gtk2-devel \
qt-devel \
tcl-devel \
tk-devel \
kernel-headers \
openssl-devel \
openssl \
libidn-devel \
mysql \
mysql-devel \
mysql-lib \
perl-devel \
perl-CPAN \
perl-JSON \
perl-App-cpanminus

RUN yum -y groupinstall "Development Tools"

# install samtools + dependancies
RUN mkdir /my-software/ ; \
curl -L -o htslib-1.2.1.tar.gz
https://github.com/samtools/htslib/archive/1.2.1.tar.gz ; \
curl -L -o samtools-1.2.tar.gz
https://github.com/samtools/samtools/archive/1.2.tar.gz ; \
tar xzf htslib-1.2.1.tar.gz ; \
tar xzf samtools-1.2.tar.gz ; \
rm -rf htslib-1.2.1.tar.gz ; \
rm -rf samtools-1.2.tar.gz ; \
mv htslib-1.2.1 /my-software/htslib ; \
mv samtools-1.2 /my-software/samtools ; \
cd /my-software/htslib ; \
make install ; \
cd /my-software/samtools ; \
make -j HTSDIR=/my-software/htslib ; \
make prefix=/my-software/usr/local/bin/ install ; \
rm -rf /htslib* /samtools-1.2*

# add samtools and htslib to path
ENV PATH=/my-software/samtools/:$PATH \
PATH=/my-software/htslib/:$PATH \
PERL_PATH=~/perl5 \
PERL5LIB=$PERL_PATH/lib/perl5:$PERL_PATH/lib/perl5/x86_64-linux-thread-multi

# Handle VEP's Perl dependencies using cpanminus to install them under $PERL_PATH:
RUN cpanm --notest -l $PERL_PATH \
Net::SSLeay \
IO::Socket::SSL \
LWP::Simple \
LWP::Protocol::https \
Archive::Extract \
Archive::Tar \
Archive::Zip \
CGI \
DBI \
DBD::mysql \
Time::HiRes

# Set temporary shell variables to store VEP and its cache
ENV VEP_PATH=/isoma-software/vep/ \
VEP_DATA=/isoma-software/.vep/

# Download the v79 release of VEP:
RUN sudo mkdir -p $VEP_PATH $VEP_DATA; cd $VEP_PATH \
&& curl -LO "https://github.com/Ensembl/ensembl-tools/archive/release/79.tar.gz" \
&& tar -zxf 79.tar.gz \
&& cd ensembl-tools-release-79/scripts/variant_effect_predictor/ \
&& sudo perl INSTALL.pl --AUTO af --SPECIES homo_sapiens --ASSEMBLY GRCh38 --DESTDIR $VEP_PATH --CACHEDIR $VEP_DATA


When I run the above Dockerfile, I get the following updated output:

Step 6/8 : RUN cpanm --notest -l $PERL_PATH Net::SSLeay IO::Socket::SSL LWP::Simple LWP::Protocol::https Archive::Extract Archive::Tar Archive::Zip CGI DBI DBD::mysql Time::HiRes
---> Running in 64e74af831a9
--> Working on Net::SSLeay
Fetching http://www.cpan.org/authors/id/M/MI/MIKEM/Net-SSLeay-1.81.tar.gz ... OK
Configuring Net-SSLeay-1.81 ... OK
Building Net-SSLeay-1.81 ... OK
Successfully installed Net-SSLeay-1.81 (upgraded from 1.55)
--> Working on IO::Socket::SSL
Fetching http://www.cpan.org/authors/id/S/SU/SULLR/IO-Socket-SSL-2.049.tar.gz ... OK
Configuring IO-Socket-SSL-2.049 ... OK
Building IO-Socket-SSL-2.049 ... OK
Successfully installed IO-Socket-SSL-2.049 (upgraded from 1.94)
--> Working on LWP::Simple
Fetching http://www.cpan.org/authors/id/O/OA/OALDERS/libwww-perl-6.26.tar.gz ... OK
Configuring libwww-perl-6.26 ... OK
==> Found dependencies: Try::Tiny, Net::HTTP
--> Working on Try::Tiny
Fetching http://www.cpan.org/authors/id/E/ET/ETHER/Try-Tiny-0.28.tar.gz ... OK
Configuring Try-Tiny-0.28 ... OK
Building Try-Tiny-0.28 ... OK
Successfully installed Try-Tiny-0.28
--> Working on Net::HTTP
Fetching http://www.cpan.org/authors/id/O/OA/OALDERS/Net-HTTP-6.16.tar.gz ... OK
Configuring Net-HTTP-6.16 ... OK
Building Net-HTTP-6.16 ... OK
Successfully installed Net-HTTP-6.16 (upgraded from 6.06)
Building libwww-perl-6.26 ... OK
Successfully installed libwww-perl-6.26 (upgraded from 6.00)
--> Working on LWP::Protocol::https
Fetching http://www.cpan.org/authors/id/O/OA/OALDERS/LWP-Protocol-https-6.07.tar.gz ... OK
Configuring LWP-Protocol-https-6.07 ... OK
==> Found dependencies: Mozilla::CA
--> Working on Mozilla::CA
Fetching http://www.cpan.org/authors/id/A/AB/ABH/Mozilla-CA-20160104.tar.gz ... OK
Configuring Mozilla-CA-20160104 ... OK
Building Mozilla-CA-20160104 ... OK
Successfully installed Mozilla-CA-20160104
Building LWP-Protocol-https-6.07 ... OK
Successfully installed LWP-Protocol-https-6.07
--> Working on Archive::Extract
Fetching http://www.cpan.org/authors/id/B/BI/BINGOS/Archive-Extract-0.80.tar.gz ... OK
Configuring Archive-Extract-0.80 ... OK
==> Found dependencies: Module::Load::Conditional
--> Working on Module::Load::Conditional
Fetching http://www.cpan.org/authors/id/B/BI/BINGOS/Module-Load-Conditional-0.68.tar.gz ... OK
Configuring Module-Load-Conditional-0.68 ... OK
==> Found dependencies: Module::Load
--> Working on Module::Load
Fetching http://www.cpan.org/authors/id/B/BI/BINGOS/Module-Load-0.32.tar.gz ... OK
Configuring Module-Load-0.32 ... OK
Building Module-Load-0.32 ... OK
Successfully installed Module-Load-0.32 (upgraded from 0.24)
Building Module-Load-Conditional-0.68 ... OK
Successfully installed Module-Load-Conditional-0.68 (upgraded from 0.54)
Building Archive-Extract-0.80 ... OK
Successfully installed Archive-Extract-0.80 (upgraded from 0.68)
--> Working on Archive::Tar
Fetching http://www.cpan.org/authors/id/B/BI/BINGOS/Archive-Tar-2.26.tar.gz ... OK
Configuring Archive-Tar-2.26 ... OK
Building Archive-Tar-2.26 ... OK
Successfully installed Archive-Tar-2.26 (upgraded from 1.92)
--> Working on Archive::Zip
Fetching http://www.cpan.org/authors/id/P/PH/PHRED/Archive-Zip-1.59.tar.gz ... OK
Configuring Archive-Zip-1.59 ... OK
Building Archive-Zip-1.59 ... OK
Successfully installed Archive-Zip-1.59 (upgraded from 1.30)
--> Working on CGI
Fetching http://www.cpan.org/authors/id/L/LE/LEEJO/CGI-4.36.tar.gz ... OK
Configuring CGI-4.36 ... OK
Building CGI-4.36 ... OK
Successfully installed CGI-4.36 (upgraded from 3.63)
--> Working on DBI
Fetching http://www.cpan.org/authors/id/T/TI/TIMB/DBI-1.636.tar.gz ... OK
Configuring DBI-1.636 ... OK
Building DBI-1.636 ... OK
Successfully installed DBI-1.636 (upgraded from 1.627)
--> Working on DBD::mysql
Fetching http://www.cpan.org/authors/id/M/MI/MICHIELB/DBD-mysql-4.042.tar.gz ... OK
==> Found dependencies: Devel::CheckLib
--> Working on Devel::CheckLib
Fetching http://www.cpan.org/authors/id/M/MA/MATTN/Devel-CheckLib-1.11.tar.gz ... OK
Configuring Devel-CheckLib-1.11 ... OK
==> Found dependencies: IO::CaptureOutput, Mock::Config
--> Working on IO::CaptureOutput
Fetching http://www.cpan.org/authors/id/D/DA/DAGOLDEN/IO-CaptureOutput-1.1104.tar.gz ... OK
Configuring IO-CaptureOutput-1.1104 ... OK
Building IO-CaptureOutput-1.1104 ... OK
Successfully installed IO-CaptureOutput-1.1104
--> Working on Mock::Config
Fetching http://www.cpan.org/authors/id/R/RU/RURBAN/Mock-Config-0.03.tar.gz ... OK
Configuring Mock-Config-0.03 ... OK
Building Mock-Config-0.03 ... OK
Successfully installed Mock-Config-0.03
Building Devel-CheckLib-1.11 ... OK
Successfully installed Devel-CheckLib-1.11
Configuring DBD-mysql-4.042 ... OK
Building DBD-mysql-4.042 ... OK
Successfully installed DBD-mysql-4.042
--> Working on Time::HiRes
Fetching http://www.cpan.org/authors/id/J/JH/JHI/Time-HiRes-1.9742.tar.gz ... OK
Configuring Time-HiRes-1.9742 ... OK
Building Time-HiRes-1.9742 ... OK
Successfully installed Time-HiRes-1.9742 (upgraded from 1.9725)
19 distributions installed
---> 7972d256ea2c
Removing intermediate container 64e74af831a9


Indicating that all submodules install correctly.

But when I run the Perl install script, it doesn't see these libraries in
@INC
.

Step 8/8 : RUN sudo mkdir -p $VEP_PATH $VEP_DATA; cd $VEP_PATH && curl -LO "https://github.com/Ensembl/ensembl-tools/archive/release/79.tar.gz" && tar -zxf 79.tar.gz && cd ensembl-tools-release-79/scripts/variant_effect_predictor/ && sudo perl INSTALL.pl --AUTO af --SPECIES homo_sapiens --ASSEMBLY GRCh38 --DESTDIR $VEP_PATH --CACHEDIR $VEP_DATA
---> Running in f0f4d991bb26
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 133 0 133 0 0 215 0 --:--:-- --:--:-- --:--:-- 214
100 161k 100 161k 0 0 105k 0 0:00:01 0:00:01 --:--:-- 569k
Using non-default installation directory /isoma-software/vep/ - you will probably need to add /isoma-software/vep/ to your PERL5LIB

Setting up directories

Downloading required files
- fetching ensembl
Trying to fetch using curl
** GET https://github.com/Ensembl/ensembl/archive/release/79.zip ==> 501 Protocol scheme 'https' is not supported (LWP::Protocol::https not installed)
** GET https://github.com/Ensembl/ensembl/archive/release/79.zip ==> 501 Protocol scheme 'https' is not supported (LWP::Protocol::https not installed)
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 124 0 124 0 0 200 0 --:--:-- --:--:-- --:--:-- 200
100 10.8M 100 10.8M 0 0 2849k 0 0:00:03 0:00:03 --:--:-- 4539k
- unpacking /isoma-software/vep//Bio/tmp/ensembl.zip
- moving files
- fetching ensembl-variation
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 134 0 134 0 0 180 0 --:--:-- --:--:-- --:--:-- 180
0 0 0 22.8M 0 0 3544k 0 --:--:-- 0:00:06 --:--:-- 5713k
- unpacking /isoma-software/vep//Bio/tmp/ensembl-variation.zip
- moving files
- fetching ensembl-funcgen
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 132 0 132 0 0 204 0 --:--:-- --:--:-- --:--:-- 204
0 0 0 2034k 0 0 848k 0 --:--:-- 0:00:02 --:--:-- 2662k
- unpacking /isoma-software/vep//Bio/tmp/ensembl-funcgen.zip
- moving files
- fetching BioPerl
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 134 0 134 0 0 210 0 --:--:-- --:--:-- --:--:-- 210
100 11.2M 100 11.2M 0 0 2259k 0 0:00:05 0:00:05 --:--:-- 2589k
- unpacking /isoma-software/vep//Bio/tmp/release-1-6-924.zip
- moving files

Testing VEP script
Can't locate Bio/EnsEMBL/Variation/Utils/VEP.pm in @INC (@INC contains: /isoma-software/vep/ensembl-tools-release-79/scripts/variant_effect_predictor/t/../ /isoma-software/vep//Bio /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at ./t/variant_effect_predictor.t line 12.
BEGIN failed--compilation aborted at ./t/variant_effect_predictor.t line 12.
./t/variant_effect_predictor.t ..
Dubious, test returned 2 (wstat 512, 0x200)
No subtests run
Can't locate Bio/EnsEMBL/Variation/Utils/VEP.pm in @INC (@INC contains: /isoma-software/vep/ensembl-tools-release-79/scripts/variant_effect_predictor/t/../ /isoma-software/vep//Bio /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at ./t/convert_cache.t line 12.
BEGIN failed--compilation aborted at ./t/convert_cache.t line 12.
./t/convert_cache.t .............
Dubious, test returned 2 (wstat 512, 0x200)
No subtests run
Can't locate Bio/EnsEMBL/Registry.pm in @INC (@INC contains: /isoma-software/vep//Bio /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /isoma-software/vep/ensembl-tools-release-79/scripts/variant_effect_predictor/t/../filter_vep.pl line 581.
BEGIN failed--compilation aborted at /isoma-software/vep/ensembl-tools-release-79/scripts/variant_effect_predictor/t/../filter_vep.pl line 581.

# Failed test 'help message'
# at ./t/filter_vep.t line 26.

# Failed test 'error on no filters'
# at ./t/filter_vep.t line 32.
Can't locate Bio/EnsEMBL/Registry.pm in @INC (@INC contains: /isoma-software/vep//Bio /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /isoma-software/vep/ensembl-tools-release-79/scripts/variant_effect_predictor/t/../filter_vep.pl line 581.
BEGIN failed--compilation aborted at /isoma-software/vep/ensembl-tools-release-79/scripts/variant_effect_predictor/t/../filter_vep.pl line 581.

# Failed test 'basic filter'
# at ./t/filter_vep.t line 36.
Can't locate Bio/EnsEMBL/Registry.pm in @INC (@INC contains: /isoma-software/vep//Bio /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /isoma-software/vep/ensembl-tools-release-79/scripts/variant_effect_predictor/t/../filter_vep.pl line 581.
BEGIN failed--compilation aborted at /isoma-software/vep/ensembl-tools-release-79/scripts/variant_effect_predictor/t/../filter_vep.pl line 581.

# Failed test 'VCF input'
# at ./t/filter_vep.t line 40.
Can't locate Bio/EnsEMBL/Registry.pm in @INC (@INC contains: /isoma-software/vep//Bio /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /isoma-software/vep/ensembl-tools-release-79/scripts/variant_effect_predictor/t/../filter_vep.pl line 581.
BEGIN failed--compilation aborted at /isoma-software/vep/ensembl-tools-release-79/scripts/variant_effect_predictor/t/../filter_vep.pl line 581.

# Failed test 'operator - is'
# at ./t/filter_vep.t line 47.
Can't locate Bio/EnsEMBL/Registry.pm in @INC (@INC contains: /isoma-software/vep//Bio /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /isoma-software/vep/ensembl-tools-release-79/scripts/variant_effect_predictor/t/../filter_vep.pl line 581.
BEGIN failed--compilation aborted at /isoma-software/vep/ensembl-tools-release-79/scripts/variant_effect_predictor/t/../filter_vep.pl line 581.
Can't locate Bio/EnsEMBL/Registry.pm in @INC (@INC contains: /isoma-software/vep//Bio /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /isoma-software/vep/ensembl-tools-release-79/scripts/variant_effect_predictor/t/../filter_vep.pl line 581.
BEGIN failed--compilation aborted at /isoma-software/vep/ensembl-tools-release-79/scripts/variant_effect_predictor/t/../filter_vep.pl line 581.
Can't locate Bio/EnsEMBL/Registry.pm in @INC (@INC contains: /isoma-software/vep//Bio /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /isoma-software/vep/ensembl-tools-release-79/scripts/variant_effect_predictor/t/../filter_vep.pl line 581.
BEGIN failed--compilation aborted at /isoma-software/vep/ensembl-tools-release-79/scripts/variant_effect_predictor/t/../filter_vep.pl line 581.
Can't locate Bio/EnsEMBL/Registry.pm in @INC (@INC contains: /isoma-software/vep//Bio /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /isoma-software/vep/ensembl-tools-release-79/scripts/variant_effect_predictor/t/../filter_vep.pl line 581.
BEGIN failed--compilation aborted at /isoma-software/vep/ensembl-tools-release-79/scripts/variant_effect_predictor/t/../filter_vep.pl line 581.
Can't locate Bio/EnsEMBL/Registry.pm in @INC (@INC contains: /isoma-software/vep//Bio /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /isoma-software/vep/ensembl-tools-release-79/scripts/variant_effect_predictor/t/../filter_vep.pl line 581.
BEGIN failed--compilation aborted at /isoma-software/vep/ensembl-tools-release-79/scripts/variant_effect_predictor/t/../filter_vep.pl line 581.
Can't locate Bio/EnsEMBL/Registry.pm in @INC (@INC contains: /isoma-software/vep//Bio /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /isoma-software/vep/ensembl-tools-release-79/scripts/variant_effect_predictor/t/../filter_vep.pl line 581.
BEGIN failed--compilation aborted at /isoma-software/vep/ensembl-tools-release-79/scripts/variant_effect_predictor/t/../filter_vep.pl line 581.

# Failed test 'operator - gte'
# at ./t/filter_vep.t line 71.
Can't locate Bio/EnsEMBL/Registry.pm in @INC (@INC contains: /isoma-software/vep//Bio /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /isoma-software/vep/ensembl-tools-release-79/scripts/variant_effect_predictor/t/../filter_vep.pl line 581.
BEGIN failed--compilation aborted at /isoma-software/vep/ensembl-tools-release-79/scripts/variant_effect_predictor/t/../filter_vep.pl line 581.
Can't locate Bio/EnsEMBL/Registry.pm in @INC (@INC contains: /isoma-software/vep//Bio /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /isoma-software/vep/ensembl-tools-release-79/scripts/variant_effect_predictor/t/../filter_vep.pl line 581.
BEGIN failed--compilation aborted at /isoma-software/vep/ensembl-tools-release-79/scripts/variant_effect_predictor/t/../filter_vep.pl line 581.

# Failed test 'operator - lte'
# at ./t/filter_vep.t line 79.
Can't locate Bio/EnsEMBL/Registry.pm in @INC (@INC contains: /isoma-software/vep//Bio /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /isoma-software/vep/ensembl-tools-release-79/scripts/variant_effect_predictor/t/../filter_vep.pl line 581.
BEGIN failed--compilation aborted at /isoma-software/vep/ensembl-tools-release-79/scripts/variant_effect_predictor/t/../filter_vep.pl line 581.

# Failed test 'operator - match'
# at ./t/filter_vep.t line 83.
Can't locate Bio/EnsEMBL/Registry.pm in @INC (@INC contains: /isoma-software/vep//Bio /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /isoma-software/vep/ensembl-tools-release-79/scripts/variant_effect_predictor/t/../filter_vep.pl line 581.
BEGIN failed--compilation aborted at /isoma-software/vep/ensembl-tools-release-79/scripts/variant_effect_predictor/t/../filter_vep.pl line 581.

# Failed test 'operator - in list'
# at ./t/filter_vep.t line 87.
Can't locate Bio/EnsEMBL/Registry.pm in @INC (@INC contains: /isoma-software/vep//Bio /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /isoma-software/vep/ensembl-tools-release-79/scripts/variant_effect_predictor/t/../filter_vep.pl line 581.
BEGIN failed--compilation aborted at /isoma-software/vep/ensembl-tools-release-79/scripts/variant_effect_predictor/t/../filter_vep.pl line 581.
Can't locate Bio/EnsEMBL/Registry.pm in @INC (@INC contains: /isoma-software/vep//Bio /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /isoma-software/vep/ensembl-tools-release-79/scripts/variant_effect_predictor/t/../filter_vep.pl line 581.
BEGIN failed--compilation aborted at /isoma-software/vep/ensembl-tools-release-79/scripts/variant_effect_predictor/t/../filter_vep.pl line 581.
Can't locate Bio/EnsEMBL/Registry.pm in @INC (@INC contains: /isoma-software/vep//Bio /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /isoma-software/vep/ensembl-tools-release-79/scripts/variant_effect_predictor/t/../filter_vep.pl line 581.
BEGIN failed--compilation aborted at /isoma-software/vep/ensembl-tools-release-79/scripts/variant_effect_predictor/t/../filter_vep.pl line 581.
Can't locate Bio/EnsEMBL/Registry.pm in @INC (@INC contains: /isoma-software/vep//Bio /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /isoma-software/vep/ensembl-tools-release-79/scripts/variant_effect_predictor/t/../filter_vep.pl line 581.
BEGIN failed--compilation aborted at /isoma-software/vep/ensembl-tools-release-79/scripts/variant_effect_predictor/t/../filter_vep.pl line 581.

# Failed test 'list fields'
# at ./t/filter_vep.t line 105.
# Got 0, expected 57
Can't locate Bio/EnsEMBL/Registry.pm in @INC (@INC contains: /isoma-software/vep//Bio /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /isoma-software/vep/ensembl-tools-release-79/scripts/variant_effect_predictor/t/../filter_vep.pl line 581.
BEGIN failed--compilation aborted at /isoma-software/vep/ensembl-tools-release-79/scripts/variant_effect_predictor/t/../filter_vep.pl line 581.

# Failed test 'count lines'
# at ./t/filter_vep.t line 109.
Can't locate Bio/EnsEMBL/Registry.pm in @INC (@INC contains: /isoma-software/vep//Bio /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /isoma-software/vep/ensembl-tools-release-79/scripts/variant_effect_predictor/t/../filter_vep.pl line 581.
BEGIN failed--compilation aborted at /isoma-software/vep/ensembl-tools-release-79/scripts/variant_effect_predictor/t/../filter_vep.pl line 581.
./t/filter_vep.t ................
Dubious, test returned 12 (wstat 3072, 0xc00)
Failed 12/21 subtests

Test Summary Report
-------------------
./t/variant_effect_predictor.t (Wstat: 512 Tests: 0 Failed: 0)
Non-zero exit status: 2
Parse errors: No plan found in TAP output
./t/convert_cache.t (Wstat: 512 Tests: 0 Failed: 0)
Non-zero exit status: 2
Parse errors: No plan found in TAP output
./t/filter_vep.t (Wstat: 3072 Tests: 21 Failed: 12)
Failed tests: 1-5, 11, 13-15, 19-21
Non-zero exit status: 12
Files=3, Tests=21, 1 wallclock secs ( 0.03 usr 0.00 sys + 0.57 cusr 0.15 csys = 0.75 CPU)
Result: FAIL

# Failed test 'ontology'
# at ./t/filter_vep.t line 116.
# Looks like you failed 12 tests of 21.
Failed 3/3 test programs. 12/21 subtests failed.
The command '/bin/sh -c sudo mkdir -p $VEP_PATH $VEP_DATA; cd $VEP_PATH && curl -LO "https://github.com/Ensembl/ensembl-tools/archive/release/79.tar.gz" && tar -zxf 79.tar.gz && cd ensembl-tools-release-79/scripts/variant_effect_predictor/ && sudo perl INSTALL.pl --AUTO af --SPECIES homo_sapiens --ASSEMBLY GRCh38 --DESTDIR $VEP_PATH --CACHEDIR $VEP_DATA' returned a non-zero code: 12

Answer Source

So the answer lay in the ENV statement.

If you group this (as I did for the RUN statements) then they wont work anymore.

I changed this to having a single ENV per line, and now it works.

Here is the working Dockerfile:

# Pull base image of centos.
FROM centos:7.3.1611

# install basics
RUN yum -y update && yum -y install wget \
    gcc \
    gcc-c++ \
    kernel-devel \
    make \
    mlocate \
    sudo \
    curl \
    rsync \
    tar \
    perl \
    perl-core \
    ansible \
    git \
    net-tools \
    which \
    cpan \
    libcurl-devel \
    python-devel \
    texlive-lastpage \
    texlive-misc.noarch \
    texlive \
    man \
    epel-release \
    ncurses-devel \
    zlib-devel \
    texinfo \
    gtk+-devel \
    gtk2-devel \
    qt-devel \
    tcl-devel \
    tk-devel \
    kernel-headers \
    kernel-devel \
    openssl-devel \
    openssl \
    libidn-devel \
    mysql \
    mysql-devel \
    mysql-lib \
    perl-devel \
    perl-CPAN \
    perl-JSON \
    perl-App-cpanminus \
    zlib

RUN yum -y groupinstall "Development Tools"

# create folders to install perl5 libs locally and for VEP locations
RUN mkdir -p /my-software/perl ; \
    mkdir -p /my-software/perl/lib/perl5 ; \

# set perl environment variables
ENV PERL_PATH=/my-software/perl/
ENV PERL5LIB=$PERL_PATH:$PERL_PATH/lib/perl5:$PERL5LIB
ENV PERL_MM_OPT="INSTALL_BASE=$PERL_PATH"
ENV PERL_MB_OPT="--install_base $PERL_PATH"
ENV PATH="$PERL_PATH/bin:$PATH"


# install samtools + dependancies
RUN mkdir /my-software/ ; \
    curl -L -o htslib-1.2.1.tar.gz  https://github.com/samtools/htslib/archive/1.2.1.tar.gz ; \
    curl -L -o samtools-1.2.tar.gz https://github.com/samtools/samtools/archive/1.2.tar.gz ; \
    tar xzf htslib-1.2.1.tar.gz ; \
    tar xzf samtools-1.2.tar.gz ; \
    rm -rf htslib-1.2.1.tar.gz ; \
    rm -rf samtools-1.2.tar.gz ; \
    mv htslib-1.2.1 /my-software/htslib ; \
    mv samtools-1.2 /my-software/samtools ; \
    cd /my-software/htslib ; \
    make install ; \
    cd /my-software/samtools ; \
    make -j HTSDIR=/my-software/htslib ; \
    make prefix=/my-software/usr/local/bin/ install ; \
    rm -rf /htslib* /samtools-1.2*


# Handle VEP's Perl dependencies using cpanminus to install them under $PERL_PATH:
RUN cpanm --notest -l $PERL_PATH \
    Net::SSLeay \
    IO::Socket::SSL \
    LWP::Simple \
    LWP::Protocol::https \
    Archive::Extract \
    Archive::Tar \
    Archive::Zip \
    CGI \
    DBI \
    DBD::mysql \
    Time::HiRes


# Download the v79 release of VEP:
RUN mkdir -p /my-software/vep ; \
    cd /my-software/vep ; \
    wget "https://github.com/Ensembl/ensembl-tools/archive/release/79.zip" ; \
    unzip 79.zip ; \
    cd /my-software/vep/ensembl-tools-release-79/scripts/variant_effect_predictor/ ; \
    perl INSTALL.pl --AUTO af --SPECIES homo_sapiens --ASSEMBLY GRCh38