Why does my Dockerfile block from executing? - node.js

Dockerfile:
FROM continuumio/miniconda:latest
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
RUN apt-get --allow-releaseinfo-change update && apt-get upgrade -y && apt-get install -qqy \
wget \
bzip2 \
graphviz \
curl
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - && apt-get install -y nodejs && apt-get install -y npm
RUN mkdir -p /backend
COPY ./backend/requirements.yml /backend/requirements.yml
RUN /opt/conda/bin/conda env create -f /backend/requirements.yml
ENV PATH /opt/conda/envs/dacheting_backend/bin:$PATH
RUN echo "source activate dacheting_backend" >~/.bashrc
RUN mkdir -p /scripts
COPY ./scripts /scripts
RUN chmod +x ./scripts*
COPY ./backend /backend
RUN mkdir -p /frontend
RUN mkdir -p /frontend_tmp
COPY ./frontend /frontend_tmp
WORKDIR frontend_tmp
RUN npm i
RUN npm run build
WORKDIR /backend
and when I try to run docker build -t xxxx:latest . I get the following error:
ERROR [ 3/18] RUN curl -sL https://deb.nodesource.com/setup_14.x |
bash - && apt-get install -y 52.2s
------ Depends: node-write-file-atomic (>= 2.3~) but it is not going to be installed E: Unable to correct problems, you have held broken packages.
(I get alot of other "Depends: .... but it is nog going to be
installed" as well)
--
I've tried looking for solutions and used different aspects but nothing worked.

I tried with this version with a few minor changes:
FROM continuumio/miniconda:latest
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
RUN apt-get update --allow-releaseinfo-change \
&& apt-get install --assume-yes --no-install-recommends --quiet \
curl \
lsb-release \
gnupg \
&& apt-get clean all
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - \
&& apt-get install --assume-yes --no-install-recommends --quiet \
nodejs
and found no problem.
Output:
$ docker build -t stackoverflow -f Dockerfile.curl
STEP 1/5: FROM continuumio/miniconda:latest
STEP 2/5: ENV LANG=C.UTF-8
--> Using cache f8fc7d943e2c988c66c1048d2524de30c010244b02390f561aae07e234a924bf
--> f8fc7d943e2
STEP 3/5: ENV LC_ALL=C.UTF-8
--> Using cache b6df639a53a673fda399433b9771b04463c232b7f6b59510ac7dc9e0db8c9cb9
--> b6df639a53a
STEP 4/5: RUN apt-get update --allow-releaseinfo-change && apt-get install --assume-yes --no-install-recommends --quiet curl lsb-release gnupg && apt-get clean all
Get:1 http://security.debian.org/debian-security buster/updates InRelease [65.4 kB]
[...]
STEP 5/5: RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - && apt-get install --assume-yes --no-install-recommends --quiet nodejs
## Installing the NodeSource Node.js 14.x repo...
## Populating apt-get cache...
+ apt-get update
Hit:1 http://security.debian.org/debian-security buster/updates InRelease
Hit:2 http://deb.debian.org/debian buster InRelease
Hit:3 http://deb.debian.org/debian buster-updates InRelease
Reading package lists...
## Confirming "buster" is supported...
+ curl -sLf -o /dev/null 'https://deb.nodesource.com/node_14.x/dists/buster/Release'
## Adding the NodeSource signing key to your keyring...
+ curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor | tee /usr/share/keyrings/nodesource.gpg >/dev/null
## Creating apt sources list file for the NodeSource Node.js 14.x repo...
+ echo 'deb [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_14.x buster main' > /etc/apt/sources.list.d/nodesource.list
+ echo 'deb-src [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_14.x buster main' >> /etc/apt/sources.list.d/nodesource.list
## Running `apt-get update` for you...
+ apt-get update
Hit:1 http://deb.debian.org/debian buster InRelease
Hit:2 http://security.debian.org/debian-security buster/updates InRelease
Hit:3 http://deb.debian.org/debian buster-updates InRelease
Get:4 https://deb.nodesource.com/node_14.x buster InRelease [4584 B]
Get:5 https://deb.nodesource.com/node_14.x buster/main amd64 Packages [768 B]
Fetched 5352 B in 1s (3748 B/s)
Reading package lists...
## Run `sudo apt-get install -y nodejs` to install Node.js 14.x and npm
## You may also need development tools to build native addons:
sudo apt-get install gcc g++ make
## To install the Yarn package manager, run:
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarnkey.gpg >/dev/null
echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarn
Reading package lists...
Building dependency tree...
Reading state information...
The following NEW packages will be installed:
nodejs
0 upgraded, 1 newly installed, 0 to remove and 62 not upgraded.
Need to get 25.0 MB of archives.
After this operation, 122 MB of additional disk space will be used.
Get:1 https://deb.nodesource.com/node_14.x buster/main amd64 nodejs amd64 14.18.1-deb-1nodesource1 [25.0 MB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 25.0 MB in 6s (4055 kB/s)
Selecting previously unselected package nodejs.
(Reading database ... 13510 files and directories currently installed.)
Preparing to unpack .../nodejs_14.18.1-deb-1nodesource1_amd64.deb ...
Unpacking nodejs (14.18.1-deb-1nodesource1) ...
Setting up nodejs (14.18.1-deb-1nodesource1) ...
COMMIT stackoverflow
--> c9d22106329
Successfully tagged localhost/stackoverflow:latest
c9d2210632965f49408570dd2808cf8dfbe50d19ffce58972865a9a9e0a6d93b

Related

Error when installing NodeJS from a Debian repo in a Docker image?

I have the following Dockerfile
FROM openjdk:8-jdk
ARG bitbucket_user
ARG bitbucket_password
# Install packages
RUN apt-get update -y \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
apt-transport-https \
lsb-release \
&& curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - \
&& echo "deb https://deb.nodesource.com/node_6.x `lsb_release -c -s` main" > /etc/apt/sources.list.d/nodesource.list \
&& apt-get update -y
When I run
docker build -t url/image_name --no-cache --build-arg bitbucket_user=user --build-arg bitbucket_password=pw .
I get
5 4.868 Hit:1 http://deb.debian.org/debian bullseye InRelease
#5 4.868 Hit:2 http://security.debian.org/debian-security bullseye-security InRelease
#5 4.875 Hit:3 http://deb.debian.org/debian bullseye-updates InRelease
#5 5.743 Ign:4 https://deb.nodesource.com/node_6.x bullseye InRelease
#5 6.385 Err:5 https://deb.nodesource.com/node_6.x bullseye Release
#5 6.385 404 Not Found [IP: 23.62.230.111 443]
#5 6.394 Reading package lists...
#5 6.909 E: The repository 'https://deb.nodesource.com/node_6.x bullseye Release' does not have a Release file.
Sure enough if I omit the last line, i.e., apt-get update -y, I can build the image, and then do this neat trick to get into the image
docker run -it url/image_name sh
...and can then do apt-get update -y once inside the image, and get the same result. What's the fix for this?

Can't install pgadmin4 repository does not have file

I was use command
sudo sh -c 'echo "deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update'
But I was got this
Err:2 https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/n/a pgadmin4 Release
404 Not Found [IP: 87.238.57.227 443]
Hit:3 https://community-packages.deepin.com/printer eagle InRelease
Hit:4 https://home-store-img.uniontech.com/appstore deepin InRelease
Reading package lists... Done
E: The repository 'https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/n/a pgadmin4 Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
So I can't install pgadmin
Use Deepin linux 20.2.3
I am using Linux mint, issue has been fixed using the below command.
$ sudo curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo apt-key add
$ sudo sh -c 'echo "deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/focal pgadmin4 main" \
> /etc/apt/sources.list.d/pgadmin4.list && apt update'
$ sudo apt update
And then, if you want desktop
$ sudo apt install pgadmin4-desktop
OR the web version:
$ sudo apt install pgadmin4-web
$ sudo /usr/pgadmin4/bin/setup-web.sh
# apt-get install curl ca-certificates gnupg
# curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
#vim /etc/apt/sources.list.d/pgdg.list
####### ADD
#deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main
# apt-get update
# apt-get install pgadmin4 pgadmin4-apache2
It should now be successfully installed.
The problem is that lsb_release -cs is not returning the codename for Deepin linux, instead is returning n/a.
Try with that dpkg --status tzdata|grep Provides|cut -f2 -d'-' to retrive the codename.
If you want a oneliner like the one you posted, here you have:
sudo sh -c 'curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo apt-key add && echo "deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(dpkg --status tzdata|grep Provides|cut -f2 -d'-') pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update'
For Ubuntu 22.10 and other versions that complain about apt-key being deprecated, use this:
curl -fsS https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo gpg --dearmor -o /usr/share/keyrings/packages-pgadmin-org.gpg
sudo sh -c 'echo "deb [signed-by=/usr/share/keyrings/packages-pgadmin-org.gpg] https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/jammy pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update'
Note that "jammy" is being used here in the ftp link. You may browse through the other versions and pick the one that matches your Ubuntu installation's version
sudo apt install pgadmin4
This installs both web and desktop versions.
I experienced this error trying to upgrade my pgadmin4 to version 6. There was a problem with the certificates on my system I think, the solution was updating ca-certificates, if it's not installed you should probably install it, but that may be very unlikely that it's not installed though as it should already be there, but either way just run the command:
sudo apt install ca-certificates
I had the same problem with Debian 11, however exploring options I found this answer enter link description here and fixed the problem by installing lsb-release

Docker installation problem (ubuntu 20.04 LTS) - E: The repository 'https://download.docker.com/linux/ubuntu \ Release' does not have a Release file

I have a problem installing docker on my virtual machine.
I have followed the steps below:
1. Older versions of Docker were called docker, docker.io, or docker-engine. If these are installed, uninstall
them:
sudo apt-get remove docker docker-engine docker.io containerd runc
2. Update the apt package index
sudo apt-get update
3. install packages to allow apt to use a repository over HTTPS:
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg \
lsb-release
4. Add Docker’s official GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
5. Use the following command to set up the stable repository:
echo \
"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg]
https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list >
/dev/null
6. Update the apt package index
sudo apt-get update
At this point - after typing sudo apt-get update - I get the following error
root#xxx:/home/xxx# sudo apt-get update
Hit:1 http://us-central1.gce.archive.ubuntu.com/ubuntu focal InRelease
Hit:2 http://us-central1.gce.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:3 http://us-central1.gce.archive.ubuntu.com/ubuntu focal-backports InRelease
Hit:4 http://security.ubuntu.com/ubuntu focal-security InRelease
Ign:5 https://download.docker.com/linux/ubuntu \ InRelease
Err:6 https://download.docker.com/linux/ubuntu \ Release
404 Not Found [IP: 13.249.137.69 443]
Reading package lists... Done
E: The repository 'https://download.docker.com/linux/ubuntu \ Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
Content of /etc/apt/sources.list.d/docker.list
deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] download.docker.com/linux/ubuntu \ focal stable
is there a way to fix it?
Make sure the content of the /etc/apt/sources.list.d/docker.list corresponds to the output of the command in the documentation, bullet #3.
At the time of this writing executing the command on my Ubuntu 20.04 LTS results in the following content of the docker.list file:
deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu focal stable
which seems to be different from that of yours.

Error when trying to install virtualbox-5.1

I'm trying to install Cuckoo (Ubuntu 64 bit) the commands that worked are:
$ sudo apt-get update
$ sudo apt-get install git -y
$ sudo apt-get install python python-pip python-dev libffi-dev libssl-dev -y
$ sudo apt-get install python-virtualenv python-setuptools -y
$ sudo apt-get install libjpeg-dev zlib1g-dev swig -y
$ sudo apt-get install mongodb -y
$ sudo apt-get install postgresql libpq-dev -y
$ echo deb http://http://download.virtualbox.org/virtualbox/debian xenial contrib | sudo tee -a /etc/apt/sources.list.d/virtualbox.list
$ wget -q https://https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
$ sudo apt-get update
$ sudo add-apt-repository "deb [arch=amd64] http://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib"
$ wget -q https://virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -
and when I executed the following command:
$ sudo apt-get install virtualbox-5.1 -y
I got the following error:
Any help please on how to fix this error?
It would be better if you downloaded the .deb package from the website rather than using apt.

Installing Azure CLI in Dockerfile can't locate package azure-cli

I'm trying to write a dockerfile that will install Azure CLI so that I can run CLI commands in bitbucket pipelines.
However the installation of the CLI always fails:
E: Unable to locate package azure-cli
The command '/bin/sh -c apt-get install azure-cli' returned a non-zero code: 100
Here is my dockerfile
FROM atlassian/default-image:latest
RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
RUN chmod +x ./kubectl
RUN mv ./kubectl /usr/local/bin/kubectl
RUN apt-get update
RUN apt-get install -y libssl-dev libffi-dev
RUN apt-get install -y python-dev
RUN apt-get install apt-transport-https lsb-release software-properties-common -y
ENV AZ_REPO $(lsb_release -cs)
RUN echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $AZ_REPO main" | tee /etc/apt/sources.list.d/azure-cli.list
RUN apt-key --keyring /etc/apt/trusted.gpg.d/Microsoft.gpg adv \
--keyserver packages.microsoft.com \
--recv-keys BC528686B50D79E339D3721CEB3E94ADBE1229CF
RUN apt-get install azure-cli
CMD ["/bin/bash"]
you need to do apt-get update after importing new package feed to get packages from that feed.

Resources