无法创建Dedeno Docker映像

时间:2020-05-14 09:25:27

标签: docker deno

我想使用Dockerfile创建deno Docker镜像

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

但是运行docker build -t deno .时,它最后显示/bin/sh: deno: not found

完整输出:

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 个答案:

答案 0 :(得分:3)

Alpine缺少glibc,这是deno运行所必需的。

您可以改用frolvlad/alpine-glibc:alpine-3.11_glibc-2.31,它将正常工作。

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

我建议构建特定的deno版本,为此,您应该使用:

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}

# ...

您还可以选中deno-docker