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
Related
I am trying to build a new image in Docker Compose but the following problem occurs
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/a/apt/apt-utils_2.4.7_amd64.deb 404 Not Found [IP: ]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
The command '/bin/sh -c apt-get install -y apt-utils' returned a non-zero code: 100
ERROR: Service 'nginx-service' failed to build : Build failed
In my Dockerfile I'm running: RUN apt-get install -y apt-utils and with --fix-missing.
None of the related questions or other solutions helped me and I've been stuck for quite a while. What am I missing?
Thanks!
EDIT: The whole Dockerfile
FROM ubuntu:latest
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y nginx
RUN apt-get clean
RUN apt-get install -y curl
RUN apt-get install -y unzip
RUN apt-get install -y wget
RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata
RUN apt-get install -y php php-xml php-curl php-fpm php-mysql
RUN apt-get install -y apt-utils --fix-missing
RUN apt-get install -y php-zip --fix-missing
RUN apt-get install -y php-gd --fix-missing
RUN apt-get install -y mysql-server
RUN curl -sS https://getcomposer.org/installer -o composer-setup.php
RUN php composer-setup.php --install-dir=/usr/local/bin --filename=composer
RUN apt-get install -y nano
RUN apt-get install -y mc
RUN apt-get install -y systemctl
RUN systemctl start nginx.service
usually , when we are building a new image, we use update then install like this
RUN apt-get update && apt-get install -y apt-utils
This will update apt source list and will make the package available to install.
Addibg this to your Dockerfile should fix the issue.
If you want to install many at once you can add the packages like the following :
RUN apt-get update && apt-get install -y \
bzr \
cvs \
git \
mercurial \
subversion \
Building the image like this:
docker-compose build --no-cache
worked for me
I am new to Docker.
I used the following command to build an image but I get errors:
sudo docker build -t docker-custom-app .
Dockerfile:
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get upgrade -y &&\
apt-get install -y curl &&\
apt-get install -y python3 &&\
apt-get install -y python3-pip &&\
pip install flask &&\
pip install flask-mysql
COPY . /opt/source-code
ENTRYPOINT FLASK_APP=/opt/source-code/app.py flask run
The error I get:
E: Unable to locate package curl
The command '/bin/sh -c apt-get update && apt-get upgrade -y &&apt-get install -y curl &&apt-get install -y python3 &&apt-get install -y python3-pip &&pip install flask &&pip install flask-mysql' returned a non-zero code: 100
even if I use another RUN command, e.g.
RUN apt-get update && apt-get upgrade -y &&\
apt-get install -y software-properties-common &&\
pip install flask &&\
pip install flask-mysql
I get https://i.stack.imgur.com/0h3Cw.png
E: Unable to locate package software-properties-common
The command '/bin/sh -c apt-get update && apt-get upgrade -y &&apt-get install -y software-properties-common &&pip install flask &&pip install flask-mysql' returned a non-zero code: 100
Or another RUN command example:
RUN apt-get update && apt-get upgrade -y &&\
apt-get install -y python3 &&\
apt-get install -y software-properties-common &&\
pip install flask &&\
pip install flask-mysql
I get an error:
E: Unable to locate package python3
The command '/bin/sh -c apt-get update && apt-get upgrade -y &&apt-get install -y python3 &&apt-get install -y software-properties-common &&pip install flask &&pip install flask-mysql' returned a non-zero code: 100
I always get an error something like Unable to locate package/returned a non-zero code:100
Any help is appreciated. Thanks.
apt-get update caused the issue, it didn't work. I think your docker installation is somehow broken or you installed docker in a wrong way. Maybe you are on mac.
I have written a dockerfile for creating selenium image with debian base image
While I am installing JDK11,I am seeing these errors.
RUN apt-get upgrade
RUN apt-get update
RUN apt-get -y install apt-transport-https curl
RUN apt-get -qqy --no-install-recommends install bzip2
RUN apt-get -qqy --no-install-recommends install ca-certificates
RUN mkdir -p /usr/share/man/man1
RUN apt-get -qqy --no-install-recommends install openjdk-11-jre-headless
RUN apt-get -qqy --no-install-recommends install ca-certificates-java
RUN dpkg --list | grep java
RUN apt-get -qqy --no-install-recommends install sudo
RUN apt-get -qqy --no-install-recommends install unzip
RUN apt-get -qqy --no-install-recommends install gdebi-core
COPY files/chrome/google-chrome_amd64.deb /google-chrome_amd64.deb
RUN gdebi --n /google-chrome_amd64.deb
RUN apt-get -qqy install xvfb
RUN rm -rf /var/lib/apt/lists/* /var/cache/apt/*
RUN echo $(ls ./usr/lib/jvm/java-11-openjdk-amd64/lib/security)
This is the docker file i am using
It's some layering issue I read somewhere else online. Don't know much about that. But that pointed me toward a usable fix: remove the folder and recreate it.
rmdir /etc/ssl/certs/java
mkdir /etc/ssl/certs/java
Now the install should work.
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 am trying to install jdk-8 in debian jessie docker containier. Below is the docker file
FROM debian:jessie
ENV DEBIAN_FRONTEND noninteractive
RUN \
echo deb http://http.debian.net/debian jessie-backports main >> /etc/apt/sources.list &&\
apt-get update && apt-get install openjdk-8-jdk &&\
update-alternatives --config java
I am getting the below error
The following packages have unmet dependencies:openjdk-8-jdk : Depends: openjdk-8-jre (= 8u131-b11-1~bpo8+1) but it is not going to be installed.Depends: openjdk-8-jdk-headless (= 8u131-b11-1~bpo8+1) but it is not going to be installed E: Unable to correct problems, you have held broken packages.The command '/bin/sh -c echo deb http://http.debian.net/debian jessie-backports main >> /etc/apt/sources.list && apt-get update && apt-get install openjdk-8-jdk && update-alternatives --config java' returned a non-zero code: 100
Please let me know how to solve this issue.
You should use below to install jdk
apt-get install -t jessie-backports openjdk-8-jdk
Below changes worked for me
apt-get -y update && apt-get install -y -t jessie-backports ca-certificates-java && apt-get -y install openjdk-8-jdk && update-alternatives --config java