Cannot create deno docker image

Viewed 739

I want to create deno docker image using Dockerfile

FROM alpine:latest

WORKDIR /

RUN apk update && \
    apk upgrade

RUN apk add curl

RUN curl -fsSL https://deno.land/x/install/install.sh | sh

ENV DENO_INSTALL="/root/.deno"

ENV PATH="${DENO_INSTALL}/bin:${PATH}"

RUN deno --help

But when run docker build -t deno . it shows at last /bin/sh: deno: not found

full output:

Sending build context to Docker daemon  54.78kB
Step 1/8 : FROM alpine:latest
 ---> f70734b6a266
Step 2/8 : WORKDIR /
 ---> Using cache
 ---> b1bbfa810906
Step 3/8 : RUN apk update &&     apk upgrade
 ---> Using cache
 ---> a7761425faba
Step 4/8 : RUN apk add curl
 ---> Using cache
 ---> 9099d4f65cb1
Step 5/8 : RUN curl -fsSL https://deno.land/x/install/install.sh | sh
 ---> Using cache
 ---> b4ea95c69a73
Step 6/8 : ENV DENO_INSTALL="/root/.deno"
 ---> Using cache
 ---> bdc7e1e85e9c
Step 7/8 : ENV PATH="${DENO_INSTALL}/bin:${PATH}"
 ---> Using cache
 ---> d35db1caba71
Step 8/8 : RUN deno --help
 ---> Running in d1ca4e1d0dc6
/bin/sh: deno: not found
The command '/bin/sh -c deno --help' returned a non-zero code: 127
1 Answers

Alpine is missing glibc which is needed for deno to run.

You can use frolvlad/alpine-glibc:alpine-3.11_glibc-2.31 instead and it will work fine.

FROM frolvlad/alpine-glibc:alpine-3.11_glibc-2.31

WORKDIR /

RUN apk update && \
    apk upgrade

RUN apk add curl

RUN curl -fsSL https://deno.land/x/install/install.sh | sh

ENV DENO_INSTALL="/root/.deno"

ENV PATH="${DENO_INSTALL}/bin:${PATH}"

RUN deno --help

I recommend building a specific deno version, for that, you should use:

curl -fsSL https://deno.land/x/install/install.sh | sh -s v1.0.0
FROM frolvlad/alpine-glibc:alpine-3.11_glibc-2.31

ENV DENO_VERSION=1.0.0

# ...

RUN curl -fsSL https://deno.land/x/install/install.sh | sh -s v${DENO_VERSION}

# ...

You can also check deno-docker

Related