Urgent.News

What's breaking now, across thousands of outlets.

Tech

Kubernetes - Day - 07 - Questions Docker ( 1 to 6 )

1 . Install Docker on your local machine. Verify the installation by running the hello-world container. docker pull hello-world docker run hello-world docker ps -a docker logs 030152e160a9 2. Pull the nginx image from Docker Hub and run it as a container. Map port 80 of the container to port 8080 of your host.

On Day 7, several questions arose regarding Docker usage. Firstly, Docker must be installed on a local machine. Verification can be achieved by pulling and running the "hello-world" container. Subsequently, the Nginx image from Docker Hub should be pulled and run as a container, mapping port 80 of the container to port 8080 on the host machine.

Next, a Dockerfile is required to create a Node.js application that serves "Hello World" on port 3000. This Dockerfile acts as a blueprint for the application, specifying the OS (Alpine), Node.js engine, and necessary libraries (like Express). The image is built with the tag "my-node-app" and then run as a container, allowing confirmation through docker ps and docker logs commands.

The Docker image "my-node-app" is then tagged with a version tag "v1.0.0." This tagged image is pushed to a Docker Hub repository, requiring authentication. Finally, a container is run from the Ubuntu image, granting an interactive shell session to execute commands like "ls" and "pwd."

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

From HTML to JavaScript: My Learning Journey

Every developer starts somewhere. This is the story of how I began learning HTML, CSS, and JavaScript, and the lessons I've learned along the way Introduction Technology has always fascinated me…

More from Saturday 26 September →