I'm trying to get Whois working in NodeJS on a Dockerfile. I'm using Whois-UX (which just spawns a whois process with the whois linux command. I'm using the "node:argon" docker image, but it doesn't have whois installed. There doesn't seem to be a way to apt-get install whois inside the image either.
I then tried to use "ubuntu:12.04", but I'm having trouble running the app with it. Here is my Dockerfile:
FROM ubuntu:12.04
WORKDIR /srv
ADD . /srv
RUN apt-get update
RUN apt-get install -y curl
RUN curl -sL https://deb.nodesource.com/setup | bash -
RUN apt-get install -y nodejs git git-core whois
RUN npm install
CMD ["node /srv/server.js"]
So, there are two possible solutions that I don't know how to solve. Figure out how to get whois on the node:argon image, or get the ubuntu docker image to work. I'd rather get whois on node:argon, because of optimizations for NodeJS, but as long as it works, it'll do.
Thanks for the help!
Whelp. I got it.
I forgot to apt-get update before I apt-get installed whois, so it didn't show the repository as being up.
FROM node:argon
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
RUN apt-get update
RUN apt-get install whois
RUN npm install bower -g
COPY package.json /usr/src/app/
RUN npm install
COPY . /usr/src/app
RUN bower install --allow-root
CMD ["npm", "start"]
^ This worked.
Related
I have a docker file like this
FROM node:18
RUN apt-get update
RUN apt-get -y install img2pdf
RUN apt-get -y install dcmtk
WORKDIR /app
COPY package.json ./
RUN yarn install
RUN yarn global add pm2 -g
COPY . .
which working smoothly on my mac m1.
But when deploying it to ubuntu 22 machine,
it failed with bunch of permission denied python3-related issue
I've tried bunch of things including reiinstall python3 and python3-pkg-resources, which make my dockerfile now looks like this
FROM node:18
RUN apt-get clean
RUN apt-get update
RUN apt-get -y reinstall python3
RUN apt-get -y reinstall python3-pkg-resources
RUN apt-get -y install img2pdf
RUN apt-get -y install dcmtk
WORKDIR /app
COPY package.json ./
RUN yarn install
RUN yarn global add pm2 -g
COPY . .
now show this error
I don't have much knowledge around docker and computer CPU.
But so far my problem happens when I run the docker on intel machine. Now I move my production server using AMD vCPU. it run as local
Would be lovely if anyone have reference the reason for it. and what people could do
I'm trying to install the npm package #stoplight/cli globally onto a docker image for use in a GitHub action. The docker image builds successfully, but when I call stoplight from /bin/bash with stoplight, I get the dreaded /usr/bin/env: 'node --no-deprecation': No such file or directory error.
I know there has been a lot of questions of this exact error, but so far none of the solutions have worked12.
I tried:
Creating symlink with ln -s /usr/bin/nodejs /usr/bin/node
Installing nodejs-legacy instead
My Dockerfile
FROM ubuntu:latest
RUN apt-get update
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash -
RUN apt-get -y install git curl
RUN apt-get install -y nodejs
RUN npm install -g #stoplight/cli#3.0.1
ENTRYPOINT ["bash", "stoplight --version"]
EDIT: ** I also tried doing this with the official debian "node" image as base, and it was the same issue.
Any help appreciated
we've released a new version of the CLI that should hopefully resolve the issue for you. The following dockerfile should work!
FROM ubuntu:latest
RUN apt-get update
RUN apt-get -y install curl
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash -
RUN apt-get install -y nodejs
RUN npm install -g #stoplight/cli#3.0.4
ENTRYPOINT ["stoplight"]
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
I have the following Dockerfile
FROM debian:jessie
MAINTAINER Ewan Valentine <ewan#theladbible.com>
WORKDIR /tmp
RUN apt-get update -y && \
apt-get install -y \
curl
RUN curl --silent --location https://deb.nodesource.com/setup_0.12 | bash -
RUN apt-get install --yes nodejs
VOLUME ["/var/www/admin/src"]
RUN mkdir -p /var/www/admin/src
WORKDIR /var/www/admin/src
RUN npm install -g gulp
ENTRYPOINT ["gulp"]
However, when I run $ docker-compose run gulp I get the following error:
[10:47:49] Local gulp not found in /var/www/admin/src
[10:47:49] Try running: npm install gulp
I'm using docker-compose and this container is linked to a volume where the source code is kept, which all runs fine otherwise.
I was liking to the wrong volume! Sorted now.
i have docker container that adds 3 volumes and links to one other docker container. this linked container links to another one.
the container contains a nodejs server that is listening on one port.
the time for starting up the container is very short.
if i try to attach to that container it tooks sometimes 3 minutes until the attach-command runs.
could anyone give me a reason why the attach command tooks so long to start?
This is my Dockerfile:
FROM ubuntu:trusty
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update
RUN apt-get -y install curl
RUN apt-get -y install nodejs
RUN apt-get -y install npm
RUN npm install forever -g
RUN npm install n -g
RUN n 0.11.11
RUN npm install gulp -g
RUN mkdir -p data/dmcms-static-ng
RUN mkdir -p data/site-ng
RUN mkdir -p data/static-ng
ADD app-run.sh /app-run.sh
RUN chmod 755 /*.sh