Score:0

Issue building local docker image

my flag

I am looking to build a docker image and its been literally years since I've had to do this, and I've forgotten most everything I've learned about docker. I wanted to test locally before uploading to GCP.

Re: I'm updating from node:12.*

Anyways, this is my dockerfile:

FROM node:16-alpine

RUN echo "deb http://nginx.org/packages/mainline/debian/ stretch nginx \deb-src http://nginx.org/packages/mainline/debian/ stretch nginx" > /etc/apt/sources.list.d/nginx.list && wget -qO - https://nginx.org/keys/nginx_signing.key | apt-key add -


RUN apt update -y && apt install -y nginx build-essential gyp libpng-dev bzip2 autoconf libtool nasm libvips-dev --no-install-recommends && rm -rf /var/lib/apt/lists/* && mkdir -p /usr/src/app

COPY ./package.json /usr/src/app/

WORKDIR /usr/src/app/

RUN npm install -g node-gyp


And I am getting this error:


Step 1/6 : FROM node:16-alpine
 ---> 2573171e0124
Step 2/6 : RUN echo "deb http://nginx.org/packages/mainline/debian/ stretch nginx \deb-src http://nginx.org/packages/mainline/debian/ stretch nginx" > /etc/apt/sources.list.d/nginx.list && wget -qO - https://nginx.org/keys/nginx_signing.key | apt-key add -
 ---> Running in ff30404cf27a
/bin/sh: can't create /etc/apt/sources.list.d/nginx.list: nonexistent directory
The command '/bin/sh -c echo "deb http://nginx.org/packages/mainline/debian/ stretch nginx \deb-src http://nginx.org/packages/mainline/debian/ stretch nginx" > /etc/apt/sources.list.d/nginx.list && wget -qO - https://nginx.org/keys/nginx_signing.key | apt-key add -' returned a non-zero code: 1

Now, that makes sense because I do NOT have this directory - but I updated this 3 years ago and don't remember coming across it. But more than that - if I don't have that directly locally (I do run nginx) - is there a way to silence it? I tried to create it and got permission issues.

vn flag
Alpine isn't a Debian/Ubuntu variant. To install nginx on Alpine, see https://wiki.alpinelinux.org/wiki/Nginx. I don't see how your Dockerfile *ever* worked in the first place.
james emanon avatar
my flag
yeah, I used the buster variant and all is good. I forgot about that - thanks for the reminder.
james emanon avatar
my flag
edit: going with bullseye
vidarlo avatar
ar flag
Why not go with a prebuilt nginx image? If you want alpine, `nginx:alpine` should do the trick?
james emanon avatar
my flag
@ceejayoz Do I even need the 2nd line ie.. "RUN echo "deb http://nginx.org/packages/mainline/debian/ stretch .." IF I am using the node:16-bullseye or 16-buster variant? Over time, I've forgotten why I added that line. I think because I was running an outdated debian image with 12.* node.. ur thoughts?
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.