launch basic bash script on docker build from windows system - windows

I would like to construct a docker image based from script bash for provisioning my system.
I try to build my image and docker tell me "Successfully built" but when I try to launch this I can see this message : "No such file or directory" and I can't viewing container in Kitematic application.
If I launch docker inspect on my container (created correctly but not launched) I can view a ExitCode 127.
Can you help me to understand issue and also help me to launch correctly a simple script bash for provisionning image docker.
dockerfile :
FROM ubuntu:trusty
MAINTAINER barbie rambo <barbierambo#mymail.com>
RUN apt-get update \
&& apt-get install -y openjdk-7-jdk wget openssh-server tar vim
COPY scripts/base.sh /home/docker/scripts/base.sh
RUN chmod 744 /home/docker/scripts/base.sh
ENTRYPOINT /home/docker/scripts/base.sh
my base.sh script
#!/usr/bin/env bash
# Set non-interactive mode
#export DEBIAN_FRONTEND=noninteractive
# Update the box
apt-get -y update
apt-get -y install linux-headers-$(uname -r) build-essential
apt-get -y install zlib1g-dev libssl-dev libreadline-gplv2-dev
apt-get -y install curl unzip
apt-get -y install software-properties-common
apt-get -y install gnupg2
# others tools
sudo apt-get -y install nano
sudo apt-get -y install vim
sudo apt-get -y install aptitude
sudo apt-get -y install git
sudo apt-get -y install openjdk-8-jre
sudo apt-get -y install whois
sudo apt-get -y install dos2unix

check whether /home/docker/scripts/base.sh has EOL as UNIX/OSX Format, if not you can do EOL Conversion in Notepad++
open file in Notepad++ -> Edit -> EOL Conversion -> UNIX/OSX Format -> Save
then rebuild docker image
If you want to get into container ten run following:
docker ps -a
and use container id
docker exec -i -t [containerID] bash
and check whether file /home/docker/scripts/base.sh exists

Related

Cannot locate a 64-bit Oracle Client library: "libclntsh.so: cannot open shared object file: No such file or directory"

I am trying to establish a connection from Azure pipelines to oracle using cx_oracle.
I'm using a Dockerfile:
FROM python:3.9-slim-buster
RUN apt-get update && apt-get install -y git && apt-get install telnet
RUN apt-get install -y gcc
RUN apt-get -y install wget
RUN apt -y install unzip
RUN wget https://download.oracle.com/otn_software/linux/instantclient/215000/instantclient-basic-linux.x64-21.5.0.0.0dbru.zip
RUN unzip instantclient-basic-linux.x64-21.5.0.0.0dbru.zip
RUN apt-get -y install libaio1
RUN sh -c "echo /instantclient_21_5 > /etc/ld.so.conf.d/oracle-instantclient.conf"
RUN ldconfig
RUN apt -y remove unzip
RUN rm instantclient-basic-linux.x64-21.5.0.0.0dbru.zip
CMD ["/bin/sh"]
Im doing automated tests using robotframework, i just updated to cx-Oracle 8.3.0. I still get the error
DatabaseError: DPI-1047:
Cannot locate a 64-bit Oracle Client library:
"libclntsh.so: cannot open shared object file:
No such file or directory".

How do I merge 2 directories with the same name in shell script

I am programming something and one of the things I need to do is to merge 2 directories. How do I do that? Rsync does not work. I tried compiling but after a few seconds it gave me errors.
These are the commands I ran (I ran these because the INSTALL.md said so):
sudo apt install -y gcc g++ gawk autoconf automake python3-cmarkgfm
sudo apt install -y acl libacl1-dev
sudo apt install -y attr libattr1-dev
sudo apt install -y libxxhash-dev
sudo apt install -y libzstd-dev
sudo apt install -y liblz4-dev
sudo apt install -y libssl-dev
./configure
make
sudo make install
a simple and efficient way is with cp
cp --force --archive --update --link ./img1/. ./img2
copy all files of ./img1 directory to ./img2 directory and replaces older items.
the --link option is for merging directories without moving any data.

Google Cloud Build and GLIBCXX_3.4.21 not found(for TexturePacker)

I'm trying to use Google Cloud Build to build my project which requires TexturePacker.
I managed to install TexturePacker but once script execute its CLI I get this error:
/usr/bin/../lib/texturepacker/TexturePacker_: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/bin/../lib/texturepacker/TexturePacker_)
Tried to install necessary lib but still no success (like below):
FROM gcr.io/cloud-builders/yarn
RUN apt-get update && apt-get install -y libgl1-mesa-glx
RUN apt-get install -y libstdc++6
RUN wget https://www.codeandweb.com/download/texturepacker/5.2.0/TexturePacker-5.2.0-ubuntu64.deb && dpkg -i TexturePacker-5.2.0-ubuntu64.deb
Does anyone has an idea on how to fix it?
I was managed to solve it using this Dockerfile:
FROM node:latest
RUN apt-get update
# Install updates and dependencies
RUN apt-get install --no-install-recommends -y -q curl python build-essential git ca-certificates libkrb5-dev imagemagick && \
apt-get clean && rm /var/lib/apt/lists/*_*
#TexturePacker and dependencies
RUN apt-get install -y libgl1-mesa-glx
RUN apt-get install -y libstdc++6
RUN wget https://www.codeandweb.com/download/texturepacker/5.2.0/TexturePacker-5.2.0-ubuntu64.deb && dpkg -i TexturePacker-5.2.0-ubuntu64.deb

`docker build` fails trying to install ubuntu packages

Trying to build a simple ubuntu apache web server docker image, I get an error while the docker build command tries installing packages. I am using the Ubuntu base image in Docker to do this. Below is the code in my Dockerfile;
FROM ubuntu
RUN apt-get update
RUN apt-get install apache2
RUN apt-get install apache2-utils
RUN apt-get clean
EXPOSE 80
CMD ["apache2ctl", "-D", "FOREGROUND"]
My Host OS is Mac OSX El Capitan, and the error I get when the build fails is;
The command '/bin/sh -c apt-get install apache2' returned a non-zero code: 1
and my docker build command is;
docker build -t="webserver" .
Any help please. Thanks in Advance.
You should use the '-y' apt-get flag when building an image.
apt-get will ask you permission to continue with apache installation, and since you can't interact with the apt-get while building the image, you must pass the '-y' flag that means 'yes' to apt-get prompt.
Try changing it to:
FROM ubuntu
RUN apt-get update
RUN apt-get install apache2 -y
RUN apt-get install apache2-utils -y
RUN apt-get clean
EXPOSE 80
CMD ["apache2ctl", "-D", "FOREGROUND"]
or even:
FROM ubuntu
RUN apt-get update && apt-get install apache2 apache2-utils -y
RUN apt-get clean
EXPOSE 80
CMD ["apache2ctl", "-D", "FOREGROUND"]

installing ghostscript with vagrant

I would like to install ghostscript when creating my vagrant environment but i have no idea how to achieve this. My provisioning script looks as following:
#!/usr/bin/env bash
sudo apt-get update
sudo apt-get install -y python-software-properties
sudo add-apt-repository -y ppa:ondrej/php5
sudo apt-get update
sudo apt-get install -y wget php5 apache2
# Apache stuff
sudo a2enmod rewrite
rm -rf /var/www
ln -fs /vagrant /var/www
sudo service apache2 restart
Inside your shell provisioning script you must define the following commands
wget http://downloads.ghostscript.com/public/ghostscript-9.10.tar.bz2
tar xjf ghostscript-9.10.tar.bz2
cd ghostscript-9.10
rm -rf zlib && ./configure --prefix=/usr --disable-compile-inits \ --enable-dynamic --with-system-libtiff && make
make so
su root
make install
gs -v
What this basically does is:
download the package
extract the contents
compiles ghostscript
installs ghostscript
checks if it installed correctly
Above explanation has to send you on it's way to install it

Resources