Latest dockerfiles and images for Deno - alpine, centos, debian, ubuntu
1M+
Docker files for Deno published on Docker Hub and GHCR:
denoland/deno:alpinedenoland/deno:debian (default)denoland/deno:distrolessdenoland/deno:ubuntudenoland/deno:binImages are available from both registries:
docker pull denoland/deno:2.7.14 # Docker Hub
docker pull ghcr.io/denoland/deno:2.7.14 # GHCR
To start the deno repl:
$ docker run -it denoland/deno:2.7.14 repl
To shell into the docker runtime:
$ docker run -it denoland/deno:2.7.14 sh
To run main.ts from your working directory:
$ docker run -it -p 1993:1993 -v $PWD:/app denoland/deno:2.7.14 run --allow-net /app/main.ts
Here, -p 1993:1993 maps port 1993 on the container to 1993 on the host,
-v $PWD:/app mounts the host working directory to /app on the container, and
--allow-net /app/main.ts is passed to deno on the container.
FROM denoland/deno:2.7.14
# The port that your application listens to.
EXPOSE 1993
WORKDIR /app
# Cache dependencies as a layer (re-run only when package.json changes).
COPY package.json .
RUN deno install
# These steps will be re-run upon each file change in your working directory:
COPY . .
# Compile the main app so that it doesn't need to be compiled each startup/entry.
RUN deno cache main.ts
# Prefer not to run as root.
USER deno
CMD ["run", "--allow-net", "--allow-read", "--allow-env", "main.ts"]
and build and run this locally:
$ docker build -t app . && docker run -it -p 1993:1993 app
If you prefer to install deno in your own base image, you can use the
denoland/deno:bin to simplify the process.
FROM ubuntu
COPY --from=denoland/deno:bin-2.7.14 /deno /usr/local/bin/deno
Due to conflicts with google cloud run caching mechanism it's required to use different path for DENO_DIR in your Dockerfile.
# set DENO_DIR to avoid conflicts with google cloud
ENV DENO_DIR=./.deno_cache
Without it GCR instance will try to download deps every time. When running with --cached-only you will get Specified not found in cache.
deno alias to your shellAlternatively, you can add deno command to your shell init file (e.g.
.bashrc):
deno () {
docker run \
--interactive \
--tty \
--rm \
--volume $PWD:/app \
--volume $HOME/.deno:/deno-dir \
--workdir /app \
denoland/deno:2.7.14 \
"$@"
}
and in your terminal
$ source ~/.bashrc
$ deno --version
$ deno run ./main.ts
See example directory.
Note: Dockerfiles provide a USER deno and DENO_DIR is set to /deno-dir/
(which can be overridden).
If running multiple Deno instances within the same image you can mount this directory as a shared volume.
Content type
Image
Digest
sha256:564e989f4…
Size
77.9 MB
Last updated
7 days ago
Requires Docker Desktop 4.37.1 or later.