avatar

Le Do Nghiem

Software Engineer

  • About me
  • Books
  • Snippets
  • Blog

© 2026 Le Do Nghiem. All rights reserved.

Contact |

Back to Blog

Deploying Apps with Docker and DigitalOcean

avatar
Le Do NghiemSoftware Engineer
2025-09-10 1 min read

Introduction

Docker simplifies app deployment by containerizing your application, and DigitalOcean provides an easy platform to host it. This guide walks you through the process.

Creating a Dockerfile

Here’s a sample Dockerfile for a Node.js app:

# Use an official Node.js runtime as the base image
FROM node:18-alpine

# Set working directory
WORKDIR /app

# Copy package.json and install dependencies
COPY package*.json ./
RUN npm install

# Copy the rest of the app
COPY . .

# Build the app
RUN npm run build

# Expose port
EXPOSE 3000

# Start the app
CMD ["npm", "start"]

Deploying to DigitalOcean

  1. Push your Docker image to a registry (e.g., Docker Hub).
  2. Create a Droplet on DigitalOcean.
  3. Install Docker on the Droplet and pull your image.
  4. Run your container with docker run.

Example: Running the Container

docker run -d -p 3000:3000 my-app:latest

Conclusion

Docker and DigitalOcean make deploying apps straightforward and scalable. Use CI/CD pipelines to automate this process for even better efficiency.

Previous Post

How I Build Scalable Web Apps

Next Post

Dependency Injection in ASP.NET Core