failed to solve with frontend dockerfile.v0: failed to build LLB: executor failed - docker

My Dockerfile
FROM centos:7
# Install Apache
RUN yum -y update
RUN yum -y install httpd httpd-tools
# Install EPEL Repo
RUN yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
RUN yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
# Install PHP
RUN yum install yum-utils
RUN yum-config-manager --enable remi-php73
RUN yum install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo
# Update Apache Configuration
RUN sed -E -i -e '/<Directory "\/var\/www\/html">/,/<\/Directory>/s/AllowOverride None/AllowOverride All/' /etc/httpd/conf/httpd.conf
RUN sed -E -i -e 's/DirectoryIndex (.*)$/DirectoryIndex index.php \1/g' /etc/httpd/conf/httpd.conf
EXPOSE 80
# Start Apache
CMD ["/usr/sbin/httpd","-D","FOREGROUND"]
When I want to build this image I get
failed to solve with frontend dockerfile.v0: failed to build LLB: executor failed running [/bin/sh -c yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm]: runc did not terminate successfully
How can build a docker image with centos apache and PHP 73?

remove the three lines
# Install EPEL Repo
RUN yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
RUN yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
those commands don't exist, I suspect you tried to copy instruction for dnf and replaced dnf with yum, that won't work.
And anyways you don't need those.
If you do need them, you can try
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
wget https://rpms.remirepo.net/enterprise/remi-release-7.rpm
rpm -Uvh remi-release-7.rpm epel-release-latest-7.noarch.rpm
or maybe
RUN yum -y update; \
yum install -y epel-release; \
rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm

Related

Installing java 8 in centos 7 dockerfile

I just looked at this question: How to define OpenJDK 8 in CentOS based Dockerfile?.
I tried the suggested answers, but I'm not getting the expected results. Here are the contents of my DockerFile
FROM centos:7
RUN yum install -y \
java-1.8.0-openjdk \
java-1.8.0-openjdk-devel
ENV JAVA_HOME /etc/alternatives/jre
RUN yum install maven
RUN yum install curl
RUN yum install -y unzip
I am building the image via: docker build -t container_image:latest -f DockerFile.build .
Then when I run docker run -it {image_id} /bin/bash and perform java --version I get bash: java: command not found. Can someone help me see what I am doing wrong here?
Also, when I try to install the jdk from within the container via yum install java-1.8.0-openjdk I get the following
java --version
Unrecognized option: --version
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
This fixed it
FROM centos
RUN yum -y update
RUN yum -y remove java
RUN yum install -y \
java-1.8.0-openjdk \
java-1.8.0-openjdk-devel
RUN yum install -y maven
RUN yum install -y curl
RUN yum install -y unzip

Docker: cannot install openssh-server

I build the Docker based on Ubuntu 16 and want to allow PuTTY access to the Ubuntu.
I have added the line to the docker file:
#Download base image ubuntu 16.04
FROM ubuntu:16.04
# Update Software repository
RUN apt-get update
# Install nginx, php-fpm and supervisord from ubuntu repository
RUN apt-get install -y nginx php7.0-fpm supervisor && \
rm -rf /var/lib/apt/lists/*
RUN apt-get autoclean -y supervisor
RUN apt-get install openssh-server -y supervisor
But when I build the image it gives me
Step 5/18 : RUN apt-get install openssh-server -y supervisor --->
Running in c9425deece29 Reading package lists... Building dependency
tree... Reading state information... E: Unable to locate package
openssh-server
How to fix it? My task is: to allow connection from a host (Windows) to the docker container via PuTTY.
Following Dockerfile should work.
#Download base image ubuntu 16.04
FROM ubuntu:16.04
# Update Software repository
RUN apt-get update && \
apt-get upgrade -y
RUN apt-get install openssh-server -y supervisor
# Install nginx, php-fpm and supervisord from ubuntu repository
RUN apt-get install -y nginx php7.0-fpm supervisor && \
rm -rf /var/lib/apt/lists/*
RUN apt-get autoclean -y supervisor
There is two thing it seems problematic to me.
After update I'm always using upgrade to update all packages on my system. It's not necessary but I find it's a good practice
You are removing /var/lib/apt/lists/ * then you are trying to install openssh-server. apt can't find anything on that path when it need.

Docker, sbt - cannot install sbt with centos docker image

I would like to have sbt in my docker image. I created a Dockerfile base on centos:centos8 image:
FROM centos:centos8
ENV SCALA_VERSION 2.13.1
ENV SBT_VERSION 0.13.18
RUN yum install -y epel-release
RUN yum update -y && yum install -y wget
RUN wget -O /usr/local/bin/sbt-launch.jar http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/$SBT_VERSION/sbt-launch.jar
WORKDIR /root
EXPOSE 8080
RUN sbt compile
CMD sbt run
And also I need to have sbt installed here, but when I ran this script I got an error:
Step 10/11 : RUN sbt compile
---> Running in 0aadcd774ba0
/bin/sh: sbt: command not found
I cannot understand why sbt could not been found. Is it a good way to achieve what I need or I should try other one? But I need to do it with centos
EDIT:
Finally it works after help from answer below. Working script looks like:
FROM centos:centos8
ENV SBT_VERSION 0.13.17
RUN yum install -y java-11-openjdk && \
yum install -y epel-release && \
yum update -y && yum install -y wget && \
wget http://dl.bintray.com/sbt/rpm/sbt-$SBT_VERSION.rpm && \
yum install -y sbt-$SBT_VERSION.rpm
WORKDIR /root
EXPOSE 8080
RUN sbt compile
CMD sbt run
You would need to install sbt inside your Dockerfile. Here is an example:
FROM centos:centos8
ENV SCALA_VERSION 2.13.1
ENV SBT_VERSION 0.13.17
RUN yum install -y epel-release
RUN yum update -y && yum install -y wget
# INSTALL JAVA
RUN yum install -y java-11-openjdk
# INSTALL SBT
RUN wget http://dl.bintray.com/sbt/rpm/sbt-${SBT_VERSION}.rpm
RUN yum install -y sbt-${SBT_VERSION}.rpm
RUN wget -O /usr/local/bin/sbt-launch.jar http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/$SBT_VERSION/sbt-launch.jar
WORKDIR /root
EXPOSE 8080
RUN sbt compile
CMD sbt run
Note: I did not see the version you had in your env variable (0.13.18) so I changed it to 0.13.17.
I ran into an issue where bintray.com was returning 403 randomly. I'm assuming it might be some kind of traffic throttle. Added the rpm file locally.
COPY sbt-0.13.18.rpm /
RUN yum install -y sbt-0.13.18.rpm

Deployment failed through docker

We are facing issue while deploying docker image in our application through Jenkins. Please can anybody help me out here.
Step 12/20 : RUN php installer
---> Running in 253d14820221
[91m/bin/sh: php: command not found
[0mThe command '/bin/sh -c php installer' returned a non-zero code: 127
[Pipeline] }
[Pipeline] // dir
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 127
Finished: FAILURE
Attached docker file-
ENV BUILD_ARGS=""
RUN yum -y update
RUN yum -y install epel-release wget
RUN wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
RUN wget https://centos7.iuscommunity.org/ius-release.rpm
RUN rpm -Uvh ius-release*.rpm
RUN yum -y update
RUN yum -y install php56u php56u-opcache php56u-xml php56u-mcrypt php56u-gd php56u-devel php56u-mysql php56u-intl php56u-mbstring php56u-bcmath nodejs git make gcc*
RUN npm install -g gulp bower
RUN wget https://getcomposer.org/installer
RUN php installer
RUN php -r "unlink('composer-setup.php');"
RUN ["mv", "/composer.phar", "/usr/local/bin/composer"]
COPY build.sh build
RUN chmod +x build
COPY cleanup.sh cleanup
RUN chmod +x cleanup
VOLUME "/wordpress"
CMD /build
Thanks in Advance
Ok So I don't know your build stage so I take the base image as centos. Looks like you have a missing enabled remi repo. May be you can try enabling remi repo and installing latest remi release too, So below two command you may need to add in your Dockerfile: RUN yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm and RUN yum-config-manager --enable remi-php56 and see if that works for you. Also, you notice php56u altered to php.
FROM centos
ENV BUILD_ARGS=""
RUN yum -y update
RUN yum -y install epel-release wget
RUN wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
RUN wget https://centos7.iuscommunity.org/ius-release.rpm
RUN yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
RUN rpm -Uvh ius-release*.rpm
RUN yum -y update
RUN yum-config-manager --enable remi-php56
RUN yum -y install php php-opcache php-xml php-mcrypt php-gd php-devel php-mysql php-intl php-mbstring php-bcmath nodejs git make gcc*
RUN npm install -g gulp bower
RUN wget https://getcomposer.org/installer
RUN php installer

docker tool box docker build behind proxy is not working in windows

Installed docker tool box in windows.
Configured everything.
We have company proxy.
So to configure proxy, did the following.
Added environment variable.
set HTTP_PROXY=xx.xx.xx.xx:10015
set HTTPS_PROXY=xx.xx.xx.xx:10015
set NO_PROXY=192.168.99.100
Then created new virtual machine with following command
docker-machine create -d virtualbox --engine-env HTTP_PROXY=xx.xx.xx.xx:10015 --engine-env HTTPS_PROXY=xx.xx.xx.xx:10015 --engine-env NO_PROXY=192.168.99.100 default
And trying to build docker image with following command
docker build -t 1234567890.dkr.ecr.us-east-1.amazonaws.com/my-repository .
Here I have docker file, which has commands as following
FROM centos:latest
MAINTAINER me - ./build_centos.sh
# Set correct environment variables.
ENV HOME /root
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
RUN yum install -y curl; yum upgrade -y; yum update -y; yum clean all
RUN yum -y update && yum -y install wget && yum -y install tar
RUN yum install -y wget unzip
RUN curl --insecure --junk-session-cookies --location --remote-name --silent --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u66-b17/jdk-8u66-linux-x64.rpm
RUN yum localinstall -y jdk-8u66-linux-x64.rpm
RUN rm jdk-8u66-linux-x64.rpm
ENV JAVA_HOME /usr/java/default
# RUN yum remove curl; yum clean all
# centos-java8U60-ssh
RUN yum -y install openssh-server initscripts
RUN echo "root:xxxxx" | chpasswd
RUN /usr/sbin/sshd-keygen
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]
RUN mkdir /opt/myimage
COPY myjara-repository-0.0.1.jar /opt/myimage
WORKDIR /opt/myimage
EXPOSE 8091
CMD java -jar myimage-repository-0.0.1.jar
But I am getting following error
Cannot find a valid baseurl for repo: base/7/x86_64
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#7 - "Failed to connect to 2a01:c0:2:4:0:acff:fe1e:1e52: Network is unreachable"
The command '/bin/sh -c yum -y update && yum -y install wget && yum -y install tar' returned a non-zero code: 1
How to solve this?

Resources