Build Docker compose Issue - docker

While composing the code in docker i am getting this error, Below is the error description.
I had tried with changing some RUN commands in docekrfile.But error is not fixed.
Below is my Complete DockerFile Code:
FROM php:7.2-apache
RUN apt-get -y update --fix-missing
RUN apt-get upgrade -y
# Install useful tools
RUN apt-get -y install apt-utils nano wget dialog
# Install important libraries
RUN apt-get -y install --fix-missing apt-utils build-essential git curl libcurl3 libcurl3-dev zip openssl
# Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# Install xdebug
RUN pecl install xdebug-2.6.0
RUN docker-php-ext-enable xdebug
# Install redis
RUN pecl install redis-4.0.1
RUN docker-php-ext-enable redis
# Other PHP7 Extensions
RUN apt-get -y install libsqlite3-dev libsqlite3-0 mysql-client
RUN docker-php-ext-install pdo_mysql
RUN docker-php-ext-install pdo_sqlite
RUN docker-php-ext-install mysqli
RUN docker-php-ext-install curl
RUN docker-php-ext-install tokenizer
RUN docker-php-ext-install json
RUN apt-get -y install zlib1g-dev
RUN docker-php-ext-install zip
RUN apt-get -y install libicu-dev
RUN docker-php-ext-install -j$(nproc) intl
RUN docker-php-ext-install mbstring
RUN docker-php-ext-install gettext
RUN apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng-dev
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
RUN docker-php-ext-install -j$(nproc) gd
# Enable apache modules
RUN a2enmod rewrite headers
E: Package 'libcurl3' has no installation candidate ERROR: The
command '/bin/sh -c apt-get -y install --fix-missing apt-utils
build-essential git curl libcurl3 libcurl3-dev zip openssl' returned a
non-zero code: 100

Related

Docker container connection timeout while installing packages

I'm having some trouble installing some packages.
The command is:
RUN apt-get update && apt-get install -yqq --fix-missing && apt-get install -yqq --no-install-recommends libkrb5-dev && apt-get clean && rm -rf /var/lib/apt/lists/*
The error is:
E: Failed to fetch http://deb.debian.org/debian/pool/main/k/krb5/libkadm5clnt-mit12_1.18.3-6%2bdeb11u1_amd64.deb 502 Connection timed out [IP: 146.75.62.132 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
ERROR: Service 'webserver' failed to build: The command '/bin/sh -c apt-get update && apt-get install -yqq --fix-missing && apt-get install -yqq --no-install-recommends libkrb5-dev && apt-get clean && rm -rf /var/lib/apt/lists/*' returned a non-zero code: 100
The connection works well and I'm able to install other packages.
This morning I was also able to build the same image correctly but suddenly it started to give me that error. Always with the same package.
Yesterday I had the same problem with other packages, but I managed to solve them by splitting the installation into different rows.
I'm having this problem with different packages every now and then and I'm 100% sure that is not a connection problem. If I add more packages before it always fails on the same package.
I tried to ping the IP from another container and it works. I also tried to open the link to download the file and everything works fine.
I always build it with the --no-cache option.
This is the complete Dockerfile
FROM php:7.4-apache-bullseye as php
# PhpUnit 8 (Version 9 doesn' support php 7.2)
# Install phpunit, the tool that we will use for testing
RUN curl --location --output /usr/local/bin/phpunit "https://phar.phpunit.de/phpunit-9.phar" && chmod +x /usr/local/bin/phpunit
WORKDIR /var/www/html
ENV DEBIAN_FRONTEND noninteractive
ENV TZ=UTC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update && apt-get install -yqq --no-install-recommends zip && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -yqq --fix-missing && apt-get install -yqq --no-install-recommends sqlite3 && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -yqq --fix-missing && apt-get install -yqq --no-install-recommends libpng-dev libcurl4-openssl-dev libxml2-dev && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -yqq --fix-missing && apt-get install -yqq --fix-missing --no-install-recommends libc-client-dev && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -yqq --fix-missing && apt-get install -yqq --fix-missing --no-install-recommends libldap2-dev && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -yqq --fix-missing && apt-get install -yqq --no-install-recommends libcap2-bin && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -yqq --fix-missing && apt-get install -yqq --no-install-recommends libldb-dev && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -yqq --fix-missing && apt-get install -yqq --no-install-recommends memcached libmemcached-dev && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y zlib1g-dev && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN docker-php-ext-configure mysql && docker-php-ext-install mysql \
&& docker-php-ext-configure gd && docker-php-ext-install gd \
&& docker-php-ext-configure curl && docker-php-ext-install curl \
&& docker-php-ext-configure imap --with-kerberos --with-imap-ssl && docker-php-ext-install imap \
&& docker-php-ext-configure xml && docker-php-ext-install xml \
&& docker-php-ext-configure soap && docker-php-ext-install soap \
&& docker-php-ext-configure bcmath && docker-php-ext-install bcmath \
&& docker-php-ext-configure intl && docker-php-ext-install intl \
&& docker-php-ext-configure ldap && docker-php-ext-install ldap
RUN pecl install igbinary && docker-php-ext-enable igbinary
RUN pecl install -o -f redis && docker-php-ext-enable redis
RUN pecl install -o -f msgpack && docker-php-ext-enable msgpack
RUN pecl install -o -f memcached && docker-php-ext-enable memcached
RUN pecl install -o -f pcov && docker-php-ext-enable pcov
RUN pecl install -o -f xdebug && docker-php-ext-enable xdebug
Thank you in advance for you help

Codeigniter 4 docker container giving Call to undefined function CodeIgniter\Autoloader\get_filenames()

I have setup codeigniter 4 in a docker container but when I run php spark serve. I get the following error
Call to undefined function CodeIgniter\Autoloader\get_filenames()
at SYSTEMPATH/Autoloader/FileLocator.php:310
Backtrace:
1 SYSTEMPATH/CLI/Commands.php:88
CodeIgniter\Autoloader\FileLocator()->listFiles('Commands/')
2 SYSTEMPATH/CLI/Commands.php:46
CodeIgniter\CLI\Commands()->discoverCommands()
3 SYSTEMPATH/Config/Services.php:153
CodeIgniter\CLI\Commands()->__construct()
4 SYSTEMPATH/Config/BaseService.php:248
CodeIgniter\Config\Services::commands(false)
5 SYSTEMPATH/Config/BaseService.php:189
CodeIgniter\Config\BaseService::__callStatic('commands', [...])
6 SYSTEMPATH/Config/Services.php:150
CodeIgniter\Config\BaseService::getSharedInstance('commands')
7 SYSTEMPATH/Config/BaseService.php:248
CodeIgniter\Config\Services::commands()
8 SYSTEMPATH/CLI/CommandRunner.php:35
CodeIgniter\Config\BaseService::__callStatic('commands', [])
9 SYSTEMPATH/CodeIgniter.php:802
CodeIgniter\CLI\CommandRunner()->__construct()
10 SYSTEMPATH/CodeIgniter.php:403
CodeIgniter\CodeIgniter()->createController()
11 SYSTEMPATH/CodeIgniter.php:320
CodeIgniter\CodeIgniter()->handleRequest(null, Object(Config\Cache), false)
12 SYSTEMPATH/CLI/Console.php:48
CodeIgniter\CodeIgniter()->run()
13 ROOTPATH/spark:63
CodeIgniter\CLI\Console()->run()
Here is my docker file:
FROM php:7.3-apache
RUN apt-get update && \
apt-get install -y
RUN apt-get install -y curl
RUN apt-get install -y build-essential libssl-dev zlib1g-dev libpng-dev libjpeg-dev libfreetype6-dev
RUN apt-get install -y libicu-dev
COPY docker/apache/000-default.conf /etc/apache2/sites-enabled/000-default.conf
RUN apt-get update
RUN docker-php-ext-install intl
RUN docker-php-ext-configure intl
RUN a2enmod rewrite
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install gd
COPY ./ /var/www/html/
RUN service apache2 restart
Any clues why this is happening? It appears that it might be some sort of path issue but I can't figure it out

Dockerfile can't open ODBC driver 17 and fails during running the python script

I have create in docker 2 contains 1 to run the MSSQL server and the other a python container with the code to read data from an .xlsx file and inserting it into SQL server.
My Dockerfile has the below code :
FROM python:3.6-alpine
RUN apk update
RUN apk add gcc libc-dev g++ libffi-dev libxml2 unixodbc-dev mariadb-dev postgresql-dev
FROM continuumio/miniconda3
ADD test.py /
RUN apt-get update -y \
&& apt install python3 -y \
&& apt install python3-pip -y \
&& apt install python3-venv -y \
&& python3 -m venv venv
RUN apt-get -y install curl
**#Install FreeTDS and dependencies for PyODBC**
RUN apt-get update && apt-get install -y tdsodbc unixodbc-dev \
&& apt install unixodbc-bin -y \
&& apt-get clean -y
RUN apt-get update
RUN apt-get install -y tdsodbc unixodbc-dev
RUN apt install unixodbc-bin -y
RUN apt-get clean -y
RUN pip install pandas
RUN pip install pyodbc
RUN pip install DateTime
RUN pip install multiprocess
RUN pip install threaded
CMD [ "python", "./test.py" ]
It compiles successfully but fails every time i run the container with the below error :
pyodbc.Error: ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib 'ODBC Driver 17 for SQL Server' : file not found (0) (SQLDriverConnect)")
I have been trying this for days but found no resolution.
Believe I need to install ODBC driver 17, if so how do I add it to my Dockerfile?

Freetype-config not found error when we install gd in php7.2-apache in Docker

I am trying to install the image php:7.2-apache from a Dockerfile,
but I have problem in gd configuration.
I have installed the latest version of docker toolbox 18.09.3 from the page https://github.com/docker/toolbox/releases/tag/v18.09.3 because I have Windows Home 10
The content of the Dockerfile is the following
FROM php:7.2-apache
RUN apt-get update && apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install -j$(nproc) gd
I have this error configure: error: freetype-config not found. during the construction of the image
checking for the location of libwebp... no
checking for the location of libjpeg... /usr/include/
checking for the location of libpng... no
checking for the location of libz... no
checking for the location of libXpm... no
checking for FreeType 2... /usr/include/
checking whether to enable JIS-mapped Japanese font support in GD... no
If configure fails try --with-webp-dir=<DIR>
checking for jpeg_read_header in -ljpeg... yes
checking for png_write_image in -lpng... yes
If configure fails try --with-xpm-dir=<DIR>
configure: error: freetype-config not found.
Service 'apache_php' failed to build: The command '/bin/sh -c apt-get update && apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng-dev && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && docker-php-ext-install -j$(nproc) gd' returned a non-zero code: 1
Any solution ?
Referring to the reply from https://github.com/docker-library/php/issues/865#issuecomment-511163936
firstly you have to patch and fix the php bug (https://bugs.php.net/bug.php?id=76324)
RUN apt-get update && apt-get install -y pkg-config patch
ADD https://git.archlinux.org/svntogit/packages.git/plain/trunk/freetype.patch?h=packages/php /tmp/freetype.patch
RUN docker-php-source extract; \
cd /usr/src/php; \
patch -p1 -i /tmp/freetype.patch; \
rm /tmp/freetype.patch
then using the following cmd :
RUN docker-php-ext-configure gd --with-freetype-dir --with-jpeg-dir=/usr/include/
I have verified it's working for php7.2-fpm
This issue is extensively clarified in the related GitHub issue, see in particular this comment.
In brief, the whole issue is related to a change in the default Debian version. Rather than applying patches or taking more complex routes, all that is needed is to add reference to stretch in the FROM line at the beginning of the Dockerfile. In this case, the first line should read:
FROM: php:7.2-apache-stretch
All else should work as expected.
this is work for me :
FROM php:7.2-fpm
RUN apt-get update && apt-get install -y \
libicu-dev \
&& docker-php-ext-install \
intl \
opcache \
&& docker-php-ext-enable \
intl \
opcache \
&& docker-php-ext-install pdo pdo_mysql \
&& docker-php-ext-install mysqli
RUN apt-get install -y zip unzip zlib1g-dev libpng-dev
RUN docker-php-ext-install gd

error running Julia on Ubuntu 16.04 docker for host with GPU

I'm stuck in getting Julia to run on Ubuntu 16.04 on a server having GPUs. Basically we want to utilise power of GPUs.
We're using Docker image to host Julia, it's pulled from nvidia-cuda, the docker image is building successfully, but when I run julia with any switch e.g. julia -v or just julia, I'm getting error ERROR: Unable to find compatible target in system image. I tried finding hints online but no luck, hence posting question here.
After building docker image, I'm running using docker run command by mounting some shared folders, it's coming up successfully, but Julia doesn't seem to work. Please let me know what wrong am I doing here.
Following is Dockerfile code
FROM nvidia/cuda:9.0-cudnn7-devel-ubuntu16.04
MAINTAINER comafire <comafire#gmail.com>
# Bash
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
USER root
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
apt-utils \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Lang
ARG locale="en_US.UTF-8"
ENV LOCALE ${locale}
RUN echo "LOCALE: $LOCALE"
RUN if [[ $LOCALE = *en* ]] \
; then \
apt-get update && apt-get install -y --no-install-recommends \
locales language-pack-en \
; else \
apt-get update && apt-get install -y --no-install-recommends \
locales language-pack-en \
; fi
RUN echo "$LOCALE UTF-8" > /etc/locale.gen && locale-gen
ENV LC_ALL ${LOCALE}
ENV LANG ${LOCALE}
ENV LANGUAGE ${LOCALE}
ENV LC_MESSAGES POSIX
# Common
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential vim curl wget git cmake bzip2 sudo unzip net-tools \
libffi-dev libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev llvm \
libfreetype6-dev libxft-dev
RUN apt-get update && apt-get install -y --no-install-recommends \
software-properties-common libjpeg-dev libpng-dev ncurses-dev imagemagick \
libgraphicsmagick1-dev libzmq-dev gfortran gnuplot gnuplot-x11 libsdl2-dev \
openssh-client htop iputils-ping
# Python2
RUN apt-get update && apt-get install -y --no-install-recommends \
python python-dev python-pip python-virtualenv python-software-properties
RUN pip2 install --upgrade pip
RUN pip2 install --cache-dir /tmp/pip2 --upgrade setuptools wheel
# Python3
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 python3-dev python3-pip python3-virtualenv python3-software-properties
RUN pip3 install --upgrade pip
RUN pip3 install --cache-dir /tmp/pip3 --upgrade setuptools wheel
# Julia
ENV JULIA_VERSION 1.0.2
RUN apt-get update && apt-get install -y build-essential libatomic1 python gfortran perl wget m4 cmake pkg-config
RUN cd /usr/local && git clone git://github.com/JuliaLang/julia.git && cd julia && git checkout v${JULIA_VERSION}
#RUN make -C deps distclean-llvm && make
RUN cd /usr/local/julia && make -j4
RUN sudo ln -s /usr/local/julia/usr/bin/julia /usr/local/bin/julia
RUN /usr/local/julia/usr/bin/julia -v
RUN ls -al /usr/local/bin
RUN julia -v
WORKDIR /tmp
COPY packages.jl ./
RUN julia packages.jl
When executing RUN julia is julia already in your $PATH? Try executing julia directly, for example:
RUN chmod +x /path/to/julia
RUN /path/to/julia

Resources