I am trying to install php7 on centos using docker. I created my dockerfile like below.
FROM centos:7
WORKDIR /tmp
RUN \
yum update -y && \
yum install -y epel-release yum-plugin-ovl && \
yum install -y gcc wget git zip vixie-cron sendmail rsyslog
# Install Nginx
ADD config/nginx/nginx.repo /etc/yum.repos.d/nginx.repo
RUN \
yum install -y nginx
# Install php
RUN \
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm && \
yum install -y yum-utils && \
yum-config-manager --enable webtatic-archive && \
yum install -y php70w php70w-devel php70w-pear && \
ln -s /usr/bin/php /usr/bin/php5
When I run the docker file I am getting the below error
> [ 6/34] RUN rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm && yum install -y yum-utils && yum-config-manager --enable webtatic-archive && yum install -y php70w php70w-devel php70w-pear && ln -s /usr/bin/php /usr/bin/php5:
#10 1.096 warning: /var/tmp/rpm-tmp.RubNcH: Header V4 RSA/SHA1 Signature, key ID 62e74ca5: NOKEY
#10 1.209 Retrieving https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
#10 1.209 Preparing... ########################################
#10 1.210 Updating / installing...
#10 1.210 webtatic-release-7-3 ########################################
#10 1.310 Loaded plugins: fastestmirror, ovl
#10 1.346 Loading mirror speeds from cached hostfile
#10 7.700 Could not retrieve mirrorlist https://mirror.webtatic.com/yum/el7/aarch64/mirrorlist error was
#10 7.700 14: HTTPS Error 404 - Not Found
#10 7.707
#10 7.707
When I try the same one in my friends laptop all working as expected.
I am using Apple m1 chip.
Related
I am using the Debian JDK image in my docker file which introduced a security vulnaribilty DSA-5139-1 [https://snyk.io/test/docker/openjdk%3A17.0-jdk-slim-bullseye]
This is my docker file -
FROM openjdk:17-jdk-slim-bullseye
RUN apt-get update \
&& apt-get install -y ca-certificates wget bash
When I build image, it gives me below version of openssl -
C:\docker-test>docker run -it openssl_test openssl version
OpenSSL 1.1.1n 15 Mar 2022
I tried to install OpenSSL 1.1.1o forcefully but when I get into bash and run openssl version, it always shows me the same version (1.1.1n) -
FROM openjdk:17-jdk-slim-bullseye
RUN apt-get -y remove openssl
RUN apt-get update \
&& apt-get install -y ca-certificates wget bash
RUN wget https://www.openssl.org/source/openssl-1.1.1o.tar.gz
Then I tried below to force the installation of openssl 1.1.1o but seems "tar" doesn't work -
FROM openjdk:17-jdk-slim-bullseye
RUN apt-get -y remove openssl
RUN apt-get update \
&& apt-get install -y ca-certificates wget bash \
&& wget https://www.openssl.org/source/openssl-1.1.1o.tar.gz \
&& tar -xzvf openssl-1.1.1o
WORKDIR /openssl-1.1.1o
RUN ./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl && make && make install
I get this error while building image -
#5 12.01 2022-05-20 19:22:46 (3.01 MB/s) - ‘openssl-1.1.1o.tar.gz’ saved [9856386/9856386]
#5 12.01
#5 12.01 tar (child): openssl-1.1.1o: Cannot open: No such file or directory
#5 12.01 tar (child): Error is not recoverable: exiting now
#5 12.01 tar: Child returned status 2
#5 12.01 tar: Error is not recoverable: exiting now
Any help would be appreciated.
This got worked for me -
FROM openjdk:17-jdk-slim-bullseye
# Perl is required to install openssl
RUN apt-get update \
&& apt-get install -y ca-certificates wget bash \
&& apt-get -qy install perl
# Remove current openssl
RUN apt-get -y remove openssl
# This is required to run “tar” command
RUN apt-get -qy install gcc
RUN apt-get -q update && apt-get -qy install wget make \
&& wget https://www.openssl.org/source/openssl-1.1.1o.tar.gz \
&& tar -xzvf openssl-1.1.1o.tar.gz \
&& cd openssl-1.1.1o \
&& ./config \
&& make install
ENV PATH "$PATH:/usr/local/ssl/bin"
And this shows the current version -
C:\docker-test>docker run -it openssl_test /bin/bash
root#e28ea8c1fb63:/# openssl version
OpenSSL 1.1.1o 3 May 2022 (Library: OpenSSL 1.1.1n 15 Mar 2022)
I have an error when trying to install the libmysqlclient-dev package together with npm for some reason when installing libmysqlclient-dev it removes npm
Step 10/26 : RUN apt-get install -y libmysqlclient-dev
---> Running in beae8aee9cd4
Reading package lists...
Building dependency tree...
Reading state information...
The following packages were automatically installed and are no longer required:
gyp javascript-common libjs-async libjs-inherits libjs-jquery
libjs-node-uuid libjs-underscore libuv1-dev node-abbrev node-ansi
node-ansi-color-table node-archy node-async node-balanced-match
node-block-stream node-brace-expansion node-builtin-modules
node-combined-stream node-concat-map node-cookie-jar node-delayed-stream
node-forever-agent node-form-data node-fs.realpath node-fstream
node-fstream-ignore node-github-url-from-git node-glob node-graceful-fs
node-hosted-git-info node-inflight node-inherits node-ini
node-is-builtin-module node-isexe node-json-stringify-safe node-lockfile
node-lru-cache node-mime node-minimatch node-mkdirp node-mute-stream
node-node-uuid node-nopt node-normalize-package-data node-npmlog node-once
node-osenv node-path-is-absolute node-pseudomap node-qs node-read
node-read-package-json node-request node-retry node-rimraf node-semver
node-sha node-slide node-spdx-correct node-spdx-expression-parse
node-spdx-license-ids node-tar node-tunnel-agent node-underscore
node-validate-npm-package-license node-which node-wrappy node-yallist
Use 'apt autoremove' to remove them.
The following additional packages will be installed:
libssl-dev
Suggested packages:
libssl-doc
The following packages will be REMOVED:
libssl1.0-dev node-gyp nodejs-dev npm
The following NEW packages will be installed:
libmysqlclient-dev libssl-dev
0 upgraded, 2 newly installed, 4 to remove and 133 not upgraded.
Need to get 2,583 kB of archives.
After this operation, 5,175 kB disk space will be freed.
Get:1 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libssl-dev amd64 1.1.1-1ubuntu2.1~18.04.9 [1,566 kB]
Get:2 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libmysqlclient-dev amd64 5.7.34-0ubuntu0.18.04.1 [1,016 kB]
dpkg-preconfigure: unable to re-open stdin:
Fetched 2,583 kB in 2s (1,412 kB/s)
(Reading database ... 25174 files and directories currently installed.)
Removing npm (3.5.2-0ubuntu4) ...
Removing node-gyp (3.6.2-1ubuntu1) ...
Removing nodejs-dev (8.10.0~dfsg-2ubuntu0.4) ...
Removing libssl1.0-dev:amd64 (1.0.2n-1ubuntu5.6) ...
That gives me the following error:
Step 14/26 : RUN npm install -g npm#4.1.1
---> Running in 18f70438b2ae
/bin/sh: 1: npm: not found
ERROR: Service 'webapp' failed to build: The command '/bin/sh -c npm install -g npm#4.1.1' returned a non-zero code: 127
This is my Dockerfile:
RUN apt-get update
RUN apt-get install -y tzdata
RUN apt-get install -y libfontconfig1
RUN apt-get install -y libxrender1
RUN apt-get install -y nodejs
RUN apt-get install -y npm
RUN apt-get install -y yarn
RUN apt-get install -y mysql-client
RUN apt-get install -y libmysqlclient-dev
RUN apt-get install -y shared-mime-info
RUN apt-get clean
RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN npm install -g npm#4.1.1
RUN npm install -g yarn
I am working on ruby on rails and I need the libmysqlclient-dev package for the mysql2 gem
How can i fix this?
You will want to read the Dockerfile best practices for the RUN instruction from the Docker docs. Each line in a Dockerfile is an image layer and the state after a RUN instruction is executed command is not always persisted on the next layer.
So the apt-get install -y npm won't affect the build when you run npm install -g ... so you received the error: npm command not found.
Please read the guide and attempt to use this single RUN instruction instead.
RUN apt-get update \
&& apt-get install -y tzdata \
&& apt-get install -y libfontconfig1 \
&& apt-get install -y libxrender1 \
&& apt-get install -y nodejs \
&& apt-get install -y npm \
&& apt-get install -y yarn \
&& apt-get install -y mysql-client \
&& apt-get install -y libmysqlclient-dev \
&& apt-get install -y shared-mime-info \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& npm install -g npm#4.1.1 \
npm install -g yarn
using a new node that comes with npm helped for me:
apt-get -qq update && \
apt-get -qq --no-install-recommends install curl && \
curl -sL https://deb.nodesource.com/setup_17.x | bash - && \
apt-get -qq --no-install-recommends install \
openssl \
nodejs \
linux-headers-generic \
tzdata \
libmysqlclient-dev
In Ubuntu 18.04 (bionic) there is a conflict between libmysqlclient-dev and the npm packages, one requires libssl1.0-dev and the other libssl-dev:
The following packages have unmet dependencies:
libssl-dev : Conflicts: libssl1.0-dev but 1.0.2n-1ubuntu5.9 needs to be installed.
libssl1.0-dev : Conflicts: libssl-dev but must install 1.1.1-1ubuntu2.1~18.04.17
It's not related to the way you were using docker, but to a conflict in the packages themselves. The easiest workaround is to install node from upstream:
RUN curl -sL https://deb.nodesource.com/setup_17.x | bash - && apt-get install -y nodejs
I am trying to build a docker image containing Nginx Web Server and PHP.
I am using a VM with centos 7
This is my Dockerfile
FROM remote-host
COPY ./conf/nginx.repo /etc/yum.repos.d/nginx.repo
RUN yum -y update && \
yum install -y epel-release && \
yum -y install nginx openssl --enablerepo=nginx && \
yum -y update && \
yum -y install https://centos7.iuscommunity.org/ius-release.rpm --nobest --skip-broken && \
yum -y install php71u-fpm php71u-cli && \
yum clean all
EXPOSE 80 443
VOLUME /var/www/html /var/log/nginx /var/log/php-fpm /var/lib/php-fpm
COPY ./conf/nginx.conf /etc/nginx/conf.d/default.conf
COPY ./bin/start.sh /start.sh
RUN chmod +x /start.sh
CMD /start.sh
This is the error output :
Problem: conflicting requests
- nothing provides epel-release = 7 needed by ius-release-2-1.el7.ius.noarch
================================================================================
Skip 1 Package
Nothing to do.
Complete!
Last metadata expiration check: 0:00:22 ago on Fri Dec 6 23:07:40 2019.
**No match for argument: php71u-fpm
No match for argument: php71u-cli
Error: Unable to find a match**
ERROR: Service 'web' failed to build: The command '/bin/sh -c yum -y update && yum install -y epel-release && yum -y install nginx openssl --enablerepo=nginx && yum -y update && yum -y install https://centos7.iuscommunity.org/ius-release.rpm --nobest --skip-broken && yum -y install php71u-fpm php71u-cli && yum clean all' returned a non-zero code: 1
Looks like epel-release package is missing.
Make sure CentOS Extras repository includes a package to install EPEL
You can check with below comands
yum search epel-release
yum info epel-release
the package family php71u is deprecated but can be downloaded by setting the repo to be "ius-archive" instead of "ius-release". like wise:
yum --enablerepo=ius-archive install php71u-fpm
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?
I'm building docker image with a Dockerfile:
FROM centos:centos7.1.1503
MAINTAINER foo <foo#bar.com>
ENV TZ "Asia/Shanghai"
ENV TERM xterm
RUN \
yum update -y && \
yum install -y epel-release &&\
yum update -y && \
yum install -y curl wget tar bzip2 unzip vim-enhanced passwd sudo yum-utils hostname net-tools rsync man && \
yum install -y gcc gcc-c++ git make automake cmake patch logrotate python-devel libpng-devel libjpeg-devel && \
yum install -y pwgen python-pip && \
yum clean all
and it show the error as below:
Error: libselinux conflicts with fakesystemd-1-17.el7.centos.noarch
If I change FROM centos:centos7.1.1503 to FROM centos:centos7,all will work fine. So ,what should I do to using centos7.1.1503
My Linux Distribution is Ubuntu 16.04.1 LTS and my docker version is 1.12.6.
Try running this inside the container you create, before any installation is made:
yum swap -y fakesystemd systemd && yum clean all
yum update -y && yum clean all
Or inside a Dockerfile at the begining before the first RUN you have tipped:
RUN yum swap -y fakesystemd systemd && yum clean all \
&& yum update -y && yum clean all
Hope was useful!