Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Sichere ProgrammierungFliproom: a room changeover is a content problem(21.09.2026 um 04:10 Uhr)
Sichere ProgrammierungNova Adiutrix: My Second Agent Built My First Project's To-Do List(21.09.2026 um 04:11 Uhr)
IT Security ToolsAntiphishing v35456910988(21.09.2026 um 02:35 Uhr)
IT Security Toolsbrave-browser v1.98.12(21.09.2026 um 03:35 Uhr)
Sichere ProgrammierungFliproom: a room changeover is a content problem(21.09.2026 um 04:10 Uhr)
Sichere ProgrammierungNova Adiutrix: My Second Agent Built My First Project's To-Do List(21.09.2026 um 04:11 Uhr)
IT Security ToolsAntiphishing v35456910988(21.09.2026 um 02:35 Uhr)
IT Security Toolsbrave-browser v1.98.12(21.09.2026 um 03:35 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

Create your first Docker Image

Reagiere als Erste:r — dein Feedback zählt!

Imagine you and your team have built an app. Now the testing team wants to test it.
Normally, they may need to install:

  • Node.js
  • npm packages
  • dependencies
  • environment setup
  • configurations

Even after all that, errors can still happen because their system may be different from yours.
Docker solves this problem by packaging your app, runtime, dependencies, and configuration into one image. The tester only needs Docker installed. They can run your image directly and test the app.

Follow these steps to create your own Docker image:

Create the folder structure displayed in the image.

folder hierarchy

Create a server.js file and add the following code inside the file.
It is a demo code that displays the OS information when the user opens the URL in the browser.

const http = require("http");
const os = require("os");

const server = http.createServer((req, res) => {
  res.writeHead(200, { "Content-Type": "text/html" });

  res.end(`
    <html>
      <body style="font-family:sans-serif;padding:40px;">
        <h1>Running Inside Docker</h1>
        <p><strong>Container Name:</strong> ${os.hostname()}</p>
        <p><strong>OS:</strong> ${os.platform()}</p>
        <p><strong>Architecture:</strong> ${os.arch()}</p>
        <p><strong>Node Version:</strong> ${process.version}</p>
        <p><strong>Current Time:</strong> ${new Date()}</p>
      </body>
    </html>
  `);
});

server.listen(3000, () => {
  console.log("Server running on port 3000");

Add the following information to the package.json file.
The package.json file contains information about the Node.js project, such as its name, version, main file, and dependencies.

{
  "name": "docker-identity",
  "version": "1.0.0",
  "main": "server.js"
}

Add the following code to your dockerfile:

FROM defines the base image. Here, node:trixie already includes Linux, Node.js, npm, and required system libraries.

WORKDIR sets /app as the working directory inside the container.

COPY copies files from your local system into the container.

RUN executes a command while building the image. Here, it runs npm install.

CMD defines the command that runs when the container starts.

FROM node:trixie
COPY package.json /app/
COPY src /app/src
WORKDIR /app/
RUN npm install
CMD ["node", "src/server.js"]

Run the following command to build the Docker image.

  • build: It is used to build the custom image.
  • . : It is the current directory
  • -t: It is the tag flag that is used to give name and version to the application
docker build -t node-app:1.0 .

After the build is successfully completed, run the following command to containerize your app.

  • run: It is used to run the image as a container.
  • -p: It is a flag that is used in port binding. Here, 3000 is the port of the container, whereas 8080 is the port of your system. So, we set 8080 as the port where you can publicly access the application.
  • node-app: It is the name of the application.
docker run -p 8080:3000 node-app:1.0

After the container runs successfully, open localhost://8080 to see your app.
The following output is displayed:

output

Why This Is Useful

Now this image can run on any system that has Docker installed.

The tester does not need to install Node.js, npm, or project dependencies manually. Everything required to run the app is already packed inside the Docker image.

Even if the tester is using Windows, macOS, or Linux, the container will run the same way.

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Create your first Docker Image

Thematisch verwandte Begriffe: Create, your, first, Docker · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-93977 | A vulnerability was determined in code-projects Assessment Management 1.…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick