Appearance
Fresh
Develop your app
Back
Learn how to containerize JavaScript applications with the Deno runtime using Docker.
JavaScript Docker Hardened Images
10 minutes
Use containers for Deno development
Copy as Markdown
Open MarkdownAsk Docs AIClaudeOpen in Claude
Table of contents
Prerequisites
Complete Containerize a Deno application.
Overview
In this section, you'll learn how to set up a development environment for your containerized application. This includes:
- Configuring Compose to automatically update your running Compose services as you edit and save your code
Get the sample application
Clone the sample application to use with this guide. Open a terminal, change directory to a directory that you want to work in, and run the following command to clone the repository:
console
$ git clone https://github.com/dockersamples/docker-deno.git && cd docker-denoAutomatically update services
Use Compose Watch to automatically update your running Compose services as you edit and save your code. For more details about Compose Watch, see Use Compose\ Watch.
Open your compose.yml file in an IDE or text editor and then add the Compose Watch instructions. The following example shows how to add Compose Watch to your compose.yml file.
<br> 1<br> 2<br> 3<br> 4<br> 5<br> 6<br> 7<br> 8<br> 9<br>10<br>11<br>12<br> | yaml<br>services:<br> server:<br> image: deno-server<br> build:<br> context: .<br> dockerfile: Dockerfile<br> ports:<br> - "8000:8000"<br> develop:<br> watch:<br> - action: rebuild<br> path: .<br> |
Run the following command to run your application with Compose Watch.
console
$ docker compose watchNow, if you modify your server.ts you will see the changes in real time without re-building the image.
To test it out, open the server.ts file in your favorite text editor and change the message from {"Status" : "OK"} to {"Status" : "Updated"}. Save the file and refresh your browser at http://localhost:8000. You should see the updated message.
Press ctrl+c in the terminal to stop your application.
Summary
In this section, you also learned how to use Compose Watch to automatically rebuild and run your container when you update your code.
Related information:
Next steps
In the next section, you'll take a look at how to set up a CI/CD pipeline using GitHub Actions.