I am trying to run below project with docker.
https://github.com/kyleferguson/laravel-with-docker-example
which has the below docker file.
FROM php:7-fpm
RUN apt-get update && apt-get install -y libmcrypt-dev mysql-client \
&& docker-php-ext-install mcrypt pdo_mysql
WORKDIR /var/www
When i run the "docker-compose up" after running the "composer install".
I get below errors.
executor failed running [/bin/sh -c apt-get update && apt-get install
-y libmcrypt-dev mariadb-client && docker-php-ext-install mcrypt pdo_mysql]: exit code: 1 ERROR: Service 'app' failed to build
Any idea on how to fix this?
Note:
I already tried replacing mariadb-client with mysql-client and default-my-client, still the same issue.
You have a couple problems here, which is why switching to mariadb didn't work on its own.
One way to make it more clear what the problem is, is to bash into a container created from your base image and run the commands manually.
docker run -it php:7-fpm bash
From there if you run each install individually you'll see where you are failing:
# apt-get install -y mysql-client
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package mysql-client
Either add a repo that provides mysql, or use mariadb.
# docker-php-ext-install mcrypt
error: /usr/src/php/ext/mcrypt does not exist
mcrypt was removed in php 7.2 so you'll need to use pecl to install it, if you really need it.
Unless you're running a very old version of Laravel, you shouldn't need mcrypt.
Related
I've just cloned a project and when I run command docker-compose up it's giving me
Step 2/20 : RUN apt-get update && apt-get install -y openssl git unzip zlib1g-dev libzip-dev libgpgme11-dev libpng-dev -y
gnupg && pecl install gnupg && docker-php-ext-enable gnupg && docker-php-ext-install gd
1 error occurred:
* Status: Invalid signal: SIGQUIT, Code: 1
I'm using latest version of docker, my OS is Windows 10 Pro 64. How can I solve this issue?
Wrapping up comments:
Typo: Second -y flag in the apt-get install command.
Steps to debug:
use verbose flag to get extended logs: docker compose --verbose up
Edit dockerfile and pull the steps apart (by creating several RUN commands instead of chaining all by &&). Then you'll see the specific command which breaks the build process.
Use docker build instead of compose to build this specific image without all the compose overhead (especially in big projects with several services). To change compose args to docker cli args see Reference
I am trying to install the java runtime in a Debian based docker image (mcr.microsoft.com/dotnet/core/sdk:3.1-buster). According to various howtos this should be possible by running
RUN apt update
RUN apt-get install openjdk-11-jre
The latter command comes back with
E: Unable to locate package openjdk-11-jre
However according to https://packages.debian.org/buster/openjdk-11-jre the package does exist. What am I doing wrong?
Unsure from which image your are pulling. I used slim, Dockerfile.
from debian:buster-slim
ENV DEBIAN_FRONTEND=noninteractive
RUN mkdir -p /usr/share/man/man1 /usr/share/man/man2
RUN apt-get update && \
apt-get install -y --no-install-recommends \
openjdk-11-jre
# Prints installed java version, just for checking
RUN java --version
NOTE: If you don't run the mkdir -p /usr/share/man/man1 /usr/share/man/man2 you'll run into dependency problems with ca-certificates, openjdk-11-jre-headless etc. I've been using this fix provided by community, haven't really checked the permanent fix.
I am trying to create a docker image with my go application. The application (which was developed on MacOS) depends on confluent-kafka-go which in turn depends on librdkafka-dev which I install in the Docker image like so:
FROM golang:1.1
RUN apt-get update
RUN apt-get -y install librdkafka-dev
VOLUME /workspace
WORKDIR /workspace/src/my/app/folder
ENTRYPOINT ["/bin/sh", "-c"]
I am getting the following error:
my/app/folder/vendor/github.com/confluentinc/confluent-kafka-go/kafka
../folder/vendor/github.com/confluentinc/confluent-kafka-go/kafka/00version.go:44:2: error: #error "confluent-kafka-go requires librdkafka v0.11.5 or later. Install the latest version of librdkafka from the Confluent repositories, see http://docs.confluent.io/current/installation.html"
As far as I understand the latest version is installed.
How can I fix it?
I had a similar issue a few weeks ago. IIRC confluent-kafka-go requires a recent version of librdkafka-dev, which simply was not yet released to alpine or others.
I was able to find it for ubuntu though, so my solution (which was more involved than I hoped for, but it worked), was to start from clean ubuntu, install librdkafka-dev, install Go version that I want and compile inside docker.
Here's how it looks:
FROM ubuntu
# Install the C lib for kafka
RUN apt-get update
RUN apt-get install -y --no-install-recommends apt-utils wget gnupg software-properties-common
RUN apt-get install -y apt-transport-https ca-certificates
RUN wget -qO - https://packages.confluent.io/deb/5.1/archive.key | apt-key add -
RUN add-apt-repository "deb [arch=amd64] https://packages.confluent.io/deb/5.1 stable main"
RUN apt-get update
RUN apt-get install -y librdkafka-dev
# Install Go
RUN add-apt-repository ppa:longsleep/golang-backports
RUN apt-get update
RUN apt-get install -y golang-1.11-go
# build the library
WORKDIR /go/src/gitlab.appsflyer.com/rantav/kafka-mirror-tester
COPY *.go ./
COPY // the rest of your go files. You may copy recursive if you want
COPY vendor vendor
RUN GOPATH=/go GOOS=linux /usr/lib/go-1.11/bin/go build -a -o main .
EXPOSE 8000
ENTRYPOINT ["./main"]
You can specify a version of package to be installed in apt-get command.
e.g
apt-get install librdkafka-dev=0.11.6~1confluent5.0.1-1
If that doesn't work then I think the apt sources doesn't have version 0.11.5 of librdkafka.
You can add a repository with the right version of librdkafka in /etc/apt/sources.list as described here:
https://docs.confluent.io/current/installation/installing_cp/deb-ubuntu.html#systemd-ubuntu-debian-install
I am using Select.HtmlToPdf.NetCore(18.3.0) to convert Html to pdf in Dotnetcore 2.1. It is perfectly working in local environment but when hosted with Docker it throws an error saying,
{"fileName":"System.TypeInitializationException: The type initializer
for 'Gdip' threw an exception. ---> System.DllNotFoundException:
Unable to load shared library 'libdl' or one of its dependencies. In
order to help diagnose loading problems, consider setting the LD_DEBUG
environment variable: liblibdl: cannot open shared object file: No
such file or directory\n at Interop.Libdl.dlopen(String fileName,
Int32 flag)\n at
System.Drawing.SafeNativeMethods.Gdip.LoadNativeLibrary()\n at
System.Drawing.SafeNativeMethods.Gdip..cctor()\n --- End of inner
exception stack trace ---\n at
System.Drawing.SafeNativeMethods.Gdip.GdipNewPrivateFontCollection(IntPtr&
fontCollection)\n at SelectPdf.Lib.ᡜ..ctor()\n at
SelectPdf.Lib...ctor()\n at SelectPdf.Lib...ctor(ᡏ A_0, A_1)\n
at SelectPdf.HtmlToPdf.ᜁ(String A_0, String A_1, String A_2, String
A_3, Boolean A_4)\n at SelectPdf.HtmlToPdf.ConvertHtmlString(String
htmlString)
I have tried by adding these set of lines in Dockerfile, but still having the same error.
FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
RUN apt-get update
RUN apt-get install -y apt-utils
RUN apt-get install -y libgdiplus
RUN ln -s /usr/lib/libgdiplus.so /usr/lib/gdiplus.dll
WORKDIR /app
EXPOSE 80
I know It is an old question but I encountered this problem lately and I would like to share with my solution.
Select.HtmlToPdf.NetCore do not work on linux
Just do not. If you already have generated string with html I would advise you to find this nuget: Haukcode.DinkToPdf
To find some tutorials just google DinkToPdf. Haukcode is just updated and more docker friendly version.
some dockerfile stuff:
FROM microsoft/aspnetcore:2.0.0 as Base
RUN apt-get update
RUN apt-get install -y apt-utils
RUN apt-get install -y libgdiplus
RUN apt-get install -y libc6-dev
RUN ln -s /usr/lib/libgdiplus.so/usr/lib/gdiplus.dll
...
I hope it will help someone :)
this worked for me.
I'm running a Debian server, using System.Drawing.Common 4.7.0
RUN apt-get update \
&& apt-get install -y --allow-unauthenticated \
libc6-dev \
libgdiplus \
libx11-dev \
&& rm -rf /var/lib/apt/lists/*
You need to install libc6-dev in your Docker container. You can install libc6-dev by running the following command:
RUN apt-get install -y libc6-dev
Let me know how that goes.
I was facing the same problem too using iTextSharp 5.5.13.1 and the way I've solved is combine #Frederik Carlier's solution in my Dockerfile:
RUN apt-get update && apt-get -y install libxml2 libgdiplus libc6-dev
After that, i've restarted Rancher Container and Rancher User Stack and it works fine.
(Runtime used: FROM microsoft/dotnet:2.2-aspnetcore-runtime)
I have a Dockerfile that works, but if I add any new dependencies to the apt-get install command, it fails. For example, this works:
FROM debian:stable
RUN apt-get update
RUN apt-get install -y \
python \
...
apache2
But if I try this, it fails:
FROM debian:stable
RUN apt-get update
RUN apt-get install -y \
python \
...
apache2
python-mysqldb
I can replace python-mysqldb with anything else, git-core, for example, and it will still fail with the same error message:
Unable to correct missing packages.
E: Failed to fetch http://security.debian.org/pool/updates/main/l/linux/linux-libc-dev_3.16.7-ckt11-1+deb8u5_amd64.deb 404 Not Found [IP: 149.20.20.6 80]
E: Aborting install.
Any thoughts on why adding a new dependency causes the failure and how to fix it?
I've found that you need to join the update & install command into the same RUN block.
eg:
RUN apt-get update \
&& apt-get install -y \
python \
...
apache2 \
python-mysqldb
According to this post describing the issue
By default, Docker cache your commands to reduce time spent building
images. Unless there was any change before such commands (or at the
same line).
Meanwhile, I notice that the AWS examples separate them, as you have them. So I dunno if it works different there. Maybe they disable the cache by default.