Skip to content

Tejas-pr/node-docker-devops

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docker Basics - Hello World App

This repository demonstrates basic Docker commands to build, run, and manage Docker containers for a simple application.

Docker Commands Covered

  • docker ps
    List all running containers.

  • docker exec <process-id> sh
    Access a running container’s shell.

  • docker images
    List all Docker images on the local machine.

  • docker build
    Build a Docker image from a Dockerfile.

  • docker build -t hello-world-app .
    Build an image and tag it as hello-world-app.

  • docker run -p 3000:3000 -e DATABASE=tejas hello-world-app
    Run a container from the image, mapping port 3000 and setting an environment variable DATABASE.

Flags Used

  • -p : Map container port to host port (e.g., 3000:3000).
  • -t : Tag the image with a name.
  • -e : Set environment variables inside the container.
  • -it : Run container in interactive mode with a terminal.

How to Use

  1. Build the Docker image:

    • docker build -t hello-world-app .
  2. Run the Docker container:

    • docker run -p 3000:3000 -e DATABASE=tejas hello-world-app
  3. List running containers:

    • docker ps
  4. Access a container shell:

    • docker exec -it sh

Explore and experiment with these commands to get comfortable using Docker for your applications!

About

learning how to write the docekr file and build a new image

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published