Dockerfile fails with install forever - dockerfile

I'm running a docker and its construction fails with this output messsage:
docker.errors.BuilError: The command '/bin/sh -c apt-get install npm'
returned a non-zero code: 1
Dockerfile has this code:
FROM ubuntu:14.04
RUN apt-get update && apt-get install -y software-properties-common
RUN apt-get install -y nodejs
RUN apt-get install npm
RUN npm install forever -g
Otherwise I can correctly execute the same commands just directy at command line outside docker's construction, and on Ubuntu 14:04.
Also I've runned another version of dockerfile without this commands, and it constructs dockers correctly.
Can you help me, please?
Thanks a lot.

I think you must pass the '-y' flag on install npm since it means 'yes' to apt-get prompt. If you look closely the other install commands already have it.

Related

Unable to install Tesseract 5.0 version on AWS Lambda

I want to run Tesseract 4.0 or Tesseract 5.0 on my AWS Lambda function. So I have my docker file like so-
FROM public.ecr.aws/lambda/python:3.8
RUN mkdir app
# Copy function code
COPY / ${LAMBDA_TASK_ROOT}/app
# Install the function's dependencies using file requirements.txt
# from your project folder.
COPY requirements.txt .
RUN pip3 install -r requirements.txt --target ${LAMBDA_TASK_ROOT}
RUN rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
RUN yum -y update
RUN yum -y install tesseract
RUN yum install -y poppler-utils
# Set the CMD to your handler (could also be done as a parameter override outside of the Dockerfile)
CMD [ "app.com.emlAndMsgParser.mail_parser_test.getEmail_from_msg" ]
but when i do DockerBuild-"docker build -t qa-lambda ." on my terminal, it says Tesseract 3.0 version is getting installed. When i deploy this built Docker image to AWS Lambda,it also says Tesseract 3.0 is installed.
But I want Tesseract 4.0 or preferably Tesserct 5.0.
I tried changing the "RUN yum -y install tesseract" in my Dockerfile to "RUN yum -y install tesseract 5.0.0-alpha-320-g8dc3" and "RUN yum -y install tesseract -y" or "RUN yum -y install tesseract*".
But all of them are installing Tesseract 3.0.
Please can anyone tell me where I am going wrong?
I am a bit new to Tesseract, so any help is appreciated..thanks!
Having the same problem, I finally created a Dockerfile myself:
FROM public.ecr.aws/lambda/java:11 q
# Prepare dev tools
RUN yum -y update
RUN yum -y install wget libstdc++ autoconf automake libtool autoconf-archive pkg-config gcc gcc-c++ make libjpeg-devel libpng-devel libtiff-devel zlib-devel
RUN yum group install -y "Development Tools"
# Build leptonica
WORKDIR /opt
RUN wget http://www.leptonica.org/source/leptonica-1.82.0.tar.gz
RUN ls -la
RUN tar -zxvf leptonica-1.82.0.tar.gz
WORKDIR ./leptonica-1.82.0
RUN ./configure
RUN make -j
RUN make install
RUN cd .. && rm leptonica-1.82.0.tar.gz
# Build tesseract
RUN wget https://github.com/tesseract-ocr/tesseract/archive/refs/tags/5.2.0.tar.gz
RUN tar -zxvf 5.2.0.tar.gz
WORKDIR ./tesseract-5.2.0
RUN ./autogen.sh
RUN PKG_CONFIG_PATH=/usr/local/lib/pkgconfig LIBLEPT_HEADERSDIR=/usr/local/include ./configure --with-extra-includes=/usr/local/include --with-extra-libraries=/usr/local/lib
RUN LDFLAGS="-L/usr/local/lib" CFLAGS="-I/usr/local/include" make -j
RUN make install
RUN /sbin/ldconfig
RUN cd .. && rm 5.2.0.tar.gz
# Optional: install language packs
RUN wget https://github.com/tesseract-ocr/tessdata/raw/main/deu.traineddata
RUN wget https://github.com/tesseract-ocr/tessdata/raw/main/eng.traineddata
RUN mv *.traineddata /usr/local/share/tessdata
WORKDIR /root
ENTRYPOINT [ "tesseract", "--version" ]
Hope this helps!

FreeTds inside Docker throwing unknown symbol exception

I'm trying to run a CGI website in a docker.
The software is written in c++ and uses to FreeTDS-dev package to connect to a mssql database.
so far its working as it should the only problem is:
If I try to compile or run it inside of the docker I receive
the following exception:
undefined symbol: dbprcollen
now I know where the exact line of code is and I also know that this particular function should be inside the freetds-dev package.
So I've included this package into the dockerfile
but it still won't work. Does Anyone know what I am missing?
Here is my dockerfile:
FROM php:apache
COPY ./html/ /var/www/html/
COPY ./work.cgi /var/www/html/work.cgi
RUN chmod +x /var/www/html/work.cgi
RUN a2enmod rewrite
RUN echo "<Directory /var/www/html/>\n\
AllowOverride all\n\
Options +ExecCGI\n\
AddHandler cgi-script .cgi\n\
</Directory>" >> /etc/apache2/apache2.conf
RUN ln -s /etc/apache2/mods-available/cgi.load /etc/apache2/mods-enabled/cgi.load
RUN apt update -y
RUN apt upgrade -y
RUN apt install build-essential -y
RUN apt install binutils -y
RUN apt install libcgicc-dev -y
RUN apt install freetds-bin -y
RUN apt install freetds-dev -y
RUN apt update --fix-missing -y
RUN apt upgrade -y

How to install AWS SAM Local on Ubuntu 16.04?

I am trying to install AWS SAM (Serverless Application Model) Local on Ubuntu 16.04.
I tried to install SAM Local using NPM with the following command.
npm install -g aws-sam-local
I got the following error.
Please help me to sort it out?
Installation on Ubuntu 16.04/18.04
sudo apt-get install python3-pip -y
sudo -H python3 -m pip install aws-sam-cli
First try
npm config set unsafe-perm=true
I also installed node v8.11.1
The standard shebang for node is #!/usr/bin/env node. There is a package conflict with the name node, so it's named nodejs.
You can solve the issue with a symlink using alternatives.
sudo update-alternatives --install /usr/bin/node node /usr/bin/nodejs 10
first try
npm install -g go-npm
then
npm install -g aws-sam-local
If issue with current user permissions, please use sudo with below commands
First try,
npm config set unsafe-perm=true
Then,
npm install -g go-npm
finally,
npm install -g aws-sam-local
It will also work for mac.

How to uninstall python in ubuntu completely and reinstalling it?

The default python version was 2.7.12 in ubuntu.
I installed python2.7.13 using the below commands.
Then download using the following command:
version=2.7.13
cd ~/Downloads/
wget https://www.python.org/ftp/python/$version/Python-$version.tgz
Extract and go to the directory:
tar -xvf Python-$version.tgz
cd Python-$version
Now, install using the command you just tried, using checkinstall instead to make it easier to uninstall if needed:
./configure
sudo make install
Now there is some issue in pandas(giving no module named pandas when I try to import but if we try to install it shows required already satisfied) so I want to completely remove python 2.7.13 and reinstall python 2.7.12. How can I achieve this?
My python was corrupted due to some module. So I planned to re-installed or remove the python completely from my Ubuntu 16.04 machine. But sudo apt-get install --reinstall python2.7 command was also failing and was throwing same error. So I finally Did few hacks and cracks. Here are the steps -
Removing all python version manually
- sudo rm -rf /usr/bin/python2.x as well as python3.x
- sudo rm -rf /usr/lib/python2.x as well as python3.x
- sudo rm -rf /usr/local/lib/python2.x as well as python 3.x
Updating Ubuntu
- sudo apt-get update
In Between if you get this error The package needs to be reinstalled ubuntu Then Run following command
sudo vi /var/lib/dpkg/status
And delete all the lines from above file for the package which was expecting re-install and run sudo apt-get update again.
Now download a python tgz file from https://www.python.org/downloads/ and unzip it and CD into it
./configure
make test
sudo make install
Python should be installed now. Check by running python

gulp: command not found

when i run gulp in cmd it says gulp: command not found
though when i checked
npm root (Path Local)
/var/www/html/gus/node_modules
npm root -g (Path Global)
/Users/zohaib/npm-global/lib/node_modules
i followed these rules though these are for OsX and im having ubuntu 16.04
To install gulp in Ubuntu, mentioned below are the steps:
sudo apt-get install node
sudo apt-get install npm
sudo npm install --global gulp
sudo apt-get install nodejs-legacy
sudo npm install
Then run gulp.