<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/security-advice-for-self-hosting-next-js-in-docker-u1tfcmcug" -->

---
title: Security advice for self-hosting Next.js in Docker
description: Learn how to ensure the security of your self-hosted Next.js applications by following best practices for container image selection, secret management, and...
canonical: https://daily.dev/posts/security-advice-for-self-hosting-next-js-in-docker-u1tfcmcug
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Security advice for self-hosting Next.js in Docker | daily.dev
og:description: Learn how to ensure the security of your self-hosted Next.js applications by following best practices for container image selection, secret management, and...
og:url: https://daily.dev/posts/security-advice-for-self-hosting-next-js-in-docker-u1tfcmcug
og:image: https://api.daily.dev/og/posts/U1tfCmCuG.png
og:image:alt: Security advice for self-hosting Next.js in Docker
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Security advice for self-hosting Next.js in Docker

**[Arcjet](https://daily.dev/sources/arcjet)** · 7 min read · 39 upvotes · 0 comments

## Summary

Learn how to ensure the security of your self-hosted Next.js applications by following best practices for container image selection, secret management, and running as a non-root user. This guide emphasizes proactive security measures, including using a minimal runtime environment, avoiding the inclusion of a shell for production containers, and leveraging external secret managers like 1Password to keep sensitive information safe.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://blog.arcjet.com/security-advice-for-self-hosting-next-js-in-docker/>

---

Tags: [#security](https://daily.dev/tags/security), [#devops](https://daily.dev/tags/devops), [#nodejs](https://daily.dev/tags/nodejs), [#docker](https://daily.dev/tags/docker), [#nextjs](https://daily.dev/tags/nextjs)

[View this post on daily.dev](https://daily.dev/posts/security-advice-for-self-hosting-next-js-in-docker-u1tfcmcug)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Security advice for self-hosting Next.js in Docker","url":"https://daily.dev/posts/security-advice-for-self-hosting-next-js-in-docker-u1tfcmcug","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/security-advice-for-self-hosting-next-js-in-docker-u1tfcmcug"},"datePublished":"2024-07-04T15:44:38.096Z","dateModified":"2024-08-23T14:32:21.588Z","description":"Learn how to ensure the security of your self-hosted Next.js applications by following best practices for container image selection, secret management, and...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/c7d70c01c5c531f5e99ed4a74bdf8a21?_a=AQAEuiZ","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/c7d70c01c5c531f5e99ed4a74bdf8a21?_a=AQAEuiZ","isAccessibleForFree":true,"articleSection":"Arcjet","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Arcjet","logo":"https://media.daily.dev/image/upload/s--4isatHz8--/f_auto/v1719499244/logos/arcjet","url":"https://daily.dev/sources/arcjet"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/security-advice-for-self-hosting-next-js-in-docker-u1tfcmcug","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":39},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"security,devops,nodejs,docker,nextjs","timeRequired":"PT7M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Arcjet","item":"https://daily.dev/sources/arcjet"},{"@type":"ListItem","position":3,"name":"Security advice for self-hosting Next.js in Docker"}]}
```

