I am trying to install nodejs using the docker console for ubuntu but I get an error installing node js. This is the error I am getting
The command [/bin/sh -c ./configure && make && make install] returned a non-zero code: 127
This is part of my dockerfile
FROM ubuntu:12.04
RUN mkdir -p /dir/subdir
RUN apt-get update
# Install nodejs
ADD http://nodejs.org/dist/v0.10.26/node-v0.10.26-linux-x64.tar.gz /dir
WORKDIR /dir/node-v0.10.26-linux-x64
RUN ./configure && make && make install
WORKDIR /dir
Exit code 127 typically means "command not found". Chances are build-essentials are not installed.
Try adding the following after the apt-get update:
RUN apt-get -y install build-essential
Related
I am trying to run this file in a docker container (I also leave the dockerfile after the error) and I can't figure out the reason for this error.
Error:
$ node main.js
Webdriver started
/Discord-Screenshare/node_modules/selenium-webdriver/remote/index.js:248
reject(Error(e.message))
^
Error: Server terminated early with status 127
at /Discord-Screenshare/node_modules/selenium-webdriver/remote/index.js:248:24
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Node.js v17.9.0
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
The command '/bin/sh -c yarn start' returned a non-zero code: 1
Dockerfile:
FROM ubuntu:20.04
# Install dependencies
RUN apt-get update
RUN apt-get install -y curl git unzip wget
RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata
RUN curl -fsSL https://deb.nodesource.com/setup_17.x | bash -
RUN apt-get install -y nodejs
RUN npm i -g yarn
# Clone Repo
RUN git clone https://github.com/MainSilent/Discord-Screenshare.git
WORKDIR Discord-Screenshare
RUN yarn install
COPY .env .
# Install chrome 88
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
# Install chromedriver 88
RUN wget https://chromedriver.storage.googleapis.com/88.0.4324.27/chromedriver_linux64.zip
RUN unzip chromedriver_linux64.zip
RUN mv chromedriver /bin
# Start Bot
RUN yarn start
I tried installing the latest version of google chrome drivers for linux and also checked if selenium was at the latest version.
I am using below script and it giving me an error #/bin/sh: 1: kpt: not found
FROM nginx
RUN apt update
RUN apt -y install git
RUN apt -y install curl
# install kpt package
RUN mkdir -p ~/bin
RUN curl -L https://github.com/GoogleContainerTools/kpt/releases/download/v1.0.0-beta.1/kpt_linux_amd64 --output ~/bin/kpt && chmod u+x ~/bin/kpt
RUN export PATH=${HOME}/bin:${PATH}
RUN SRC_REPO=https://github.com/kubeflow/manifests
RUN kpt pkg get $SRC_REPO/tf-training#v1.1.0 tf-training
But if I create the image using
FROM nginx
RUN apt update
RUN apt -y install git
RUN apt -y install curl
and perform
docker exec -it container_name bash
and manually do the task then I am able to install kpt package. Sharing below the screenshot of the process
The error changes if I provide the full path to /bin/kpt
Error: ambiguous repo/dir#version specify '.git' in argument
FROM nginx
RUN apt update
RUN apt -y install git
RUN apt -y install curl
RUN mkdir -p ~/bin
RUN curl -L https://github.com/GoogleContainerTools/kpt/releases/download/v1.0.0-beta.1/kpt_linux_amd64 --output ~/bin/kpt && chmod u+x ~/bin/kpt
RUN export PATH=${HOME}/bin:${PATH}
# Below line of code is to ensure that kpt is installed and working fine
RUN ~/bin/kpt pkg get https://github.com/ajinkya101/kpt-demo-repo.git/Packages/Nginx
RUN SRC_REPO=https://github.com/kubeflow/manifests
RUN ~/bin/kpt pkg get $SRC_REPO/tf-training#v1.1.0 tf-training
What is happening when I am using docker and not able to install it?
First, make sure SRC_REPO is declared as a Dockerfile environment variable
ENV SRC_REPO=https://github.com/kubeflow/manifests.git
^^^ ^^^^
And make sure the URL ends with .git.
As mentioned in kpt get:
In most cases the .git suffix should be specified to delimit the REPO_URI from the PKG_PATH, but this is not required for widely recognized repo prefixes.
Second, to be sure, specify the full path of kpt, without ~ or ${HOME}.
/root/bin/kpt
For testing, add a RUN id -a && pwd to be sure who and where you are when using the nginx image.
I'm trying install pyodbc in docker running inside linux container
But I'm getting the following error
Click here to view the image
src/pyodbc.h:56:10: fatal error: sql.h: No such file or directory
#include <sql.h>
^~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for pyodbc
Here is my dockerfile
FROM mcr.microsoft.com/azure-functions/python:2.0
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
AzureFunctionsJobHost__Logging__Console__IsEnabled=true
COPY . /home/site/wwwroot
FROM ubuntu
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && \
apt-get -y install gcc mono-mcs && \
rm -rf /var/lib/apt/lists/*
FROM python
RUN apt-get update && apt-get install -y python3-pip
# RUN /usr/bin/pip -r /home/site/wwwroot/requirements.txt
# WORKDIR /home/site/wwwroot
COPY --from=0 /home/site/wwwroot /home/site/wwwroot
RUN cd /home/site/wwwroot && pip install -r requirements.txt
Note: I'm going push the code to the azure functionapp in linux machine
I had the same issue, I added the below code in my docker file, and it started working. Microsoft docker image is missing unixodbc-dev, so you need to install separately using the below command.
RUN apt-get update && apt-get install -y --no-install-recommends \
unixodbc-dev \
unixodbc \
libpq-dev
This is the setup that worked for me:
# pull official base image
FROM python:3.9.2-slim-buster
# install system dependencies
RUN apt-get update \
&& apt-get -y install gcc \
&& apt-get -y install g++ \
&& apt-get -y install unixodbc unixodbc-dev \
&& apt-get clean
And the pyodbc package was installed successfully.
The error is:
src/pyodbc.h:56:10: fatal error: sql.h: No such file or directory
#include <sql.h>
This is telling you that you are missing a file sql.h. Looking at the documentation for PyODBC, it appears to require the UnixODBC development environment.
There are installation instructions at the above link for most major distributions. You will need to update your Dockerfile to install the unixodbc-dev package.
This link is also helpful, you are missing mandatory files to needed to install. Add the below command for Debain to Dockerfile , the link has all solutions
RUN apt-get update && apt-get install -y gcc unixodbc-dev
https://github.com/mkleehammer/pyodbc/issues/165
The consolidated list of dependencies needed for pyodbc can be found in the documentation. Make sure all of these are installed.
PYODBC installation documentation
I am trying to upgrade the node version to meet other dependencies of my project. And I have tried various methods to find a proper solution. But unfortunately, nothing is working. I end up trying this
and no change in the response.
My current node version is v0.10.33. This is actually implemented on docker. I am attaching the docker file below.
FROM node:6.2.1
RUN apt-get update --fix-missing
RUN apt-get install -y supervisor
RUN apt-get install -y python-pip && pip install supervisor-stdout
# Cleanup
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN apt-get autoremove -y
#ADD ./config/supervisord.conf /etc/supervisor/conf.d/supervisord- nodejs.conf
RUN ln -s /usr/bin/nodejs /usr/local/bin/node
ADD package.json /
ONBUILD RUN npm install
WORKDIR /app
ADD . /app
RUN npm update
EXPOSE 8080
CMD ["/usr/bin/supervisord", "-n"]
#ENTRYPOINT ["/nodejs/bin/npm", "start"]
Since I am not pretty good at docker and node don't what is happening. Even though docker file started with From node:6.2.1 the node version instaling is v0.10.33. And that is a weird thing I am experiencing. All kinda help are appreciated.
The ln -s is the wrong way around and should be failing.
Step 7 : RUN ln -s /usr/bin/nodejs /usr/local/bin/node
---> Running in 4f1e92a58fe8
ln: failed to create symbolic link '/usr/local/bin/node': File exists
The command '/bin/sh -c ln -s /usr/bin/nodejs /usr/local/bin/node' returned a non-zero code: 1
If you hadn't noticed this error then you would be running the old image still with node v0.10.33.
Change that line to
RUN ln -s /usr/local/bin/node /usr/bin/nodejs
If this is part of some build scripts, always check the exit status of your commands. In bash, $? will give you the return code or set -e will automagically check return codes for you.
I'm trying to use docker with my node application, my Dockerfile looks like this:
RUN apt-get update
RUN apt-get -y install build-essential
RUN apt-get install -y nodejs
RUN apt-get install -y npm
ADD . /src
RUN cd /src && npm install
EXPOSE 8080
CMD ["node","/src/app.js"]
but after running docker build when npm install is running after trying to install https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz I get an error:
The command 'bin/sh -c /src && npm install' returned a non-zero code : 1
What can cause such an issue? I've already tried to install node-legacy instead of node and it didn't work
Try this:
# put this line on your code (if you are using ubuntu)
# this make a link from nodejs to node to add compatibility on ubuntu OS
RUN ln -s /usr/bin/nodejs /usr/bin/node
# set your current directory with WORKDIR
WORKDIR /src
RUN sudo npm install