DevSecOps for BBK
  • Introduction
  • Getting Started
    • Virtual Training Practices
    • Training Plan
    • Tools and Configuration
    • Troubleshooting
  • Docker Fundamentals
    • Docker Setup
    • Docker First Container
    • Docker Network Basics
    • Docker Network Exercise
    • Docker Volume Basics
    • Docker Storage
  • Dockerfile Fundamentals
    • Dockerfile Instructions
    • Dockerfile Environment Variables
    • Dockerfile Build Arguments
    • Non-privileged Containers
    • Dockerfile Order of Execution
    • Dockerfile Volume
    • Entrypoint Command
    • Multiple Stage Build
  • Container Management
    • Containers Start Automatically
  • Docker Security
    • Seccomp Profile
  • Docker Compose
    • Docker Compose Install
    • Docker Compose Commands
    • Docker Compose File
    • Docker Compose Volumes and Network
  • K8s Cluster Setup
    • Minikube Installation
    • Calico Networking
    • K8s Walkthrough
    • K8s Cheat Sheet
  • Understand K8s
    • Pod Connectivity
    • Deployments
    • Service Cluster IP
    • Service NodePort
    • ClusterIP Exercise
    • NodePort Exercise
    • Service LoadBalancer
    • Configmap
    • Secrets
  • Application Lifecycle Management
    • Rolling Updates and Rollback
    • Multi Container Pod
  • K8s Storage
    • Persistent Volume
    • Persistent Volume Claim
    • PVC in POD
  • Istio
    • AKS Setup
    • Kubectl Setup in Windows
    • Istio Setup Manual
    • Istio Demo App
    • Istio Observability
  • Terraform
    • Terraform Setup
    • Terraform Demo
    • Azure Terraform Setup
  • Terraform AWS
    • Terraform AWS Setup
    • Terraform AWS Demo S3
  • Refrences
    • Docker Static Site
    • Docker First Image
Powered by GitBook
On this page
  1. Dockerfile Fundamentals

Entrypoint Command

In this lesson, we will begin working with the ENTRYPOINT instruction. Though ENTRYPOINT functions very similarly to CMD it's behaviors are very different.

ENTRYPOINT allows us to configure a container that will run as an executable. We can override all elements specified using CMD. Using the docker run --entrypoint flag will override the ENTRYPOINT instruction.

Step 1: Setup your environment:

mkdir entrypoint
cd entrypoint

Step 2: Clone the image:

git clone https://github.com/nishanthkumarpathi/content-weather-app.git src

Step 3: Create the Dockerfile:

vi Dockerfile

Step 3: Create an image for the weather-app

Dockerfile contents:

FROM node
LABEL org.label-schema.version=v1.1
ENV NODE_ENV="production"
ENV PORT 3001

RUN mkdir -p /var/node
ADD src/ /var/node/
WORKDIR /var/node
RUN npm install
EXPOSE $PORT
ENTRYPOINT ./bin/www

Step 4: Build the image:

docker image build -t nishanthkp/weather-app:v4 .

Step 5: Deploy the weather-app:

docker container run -d --name weather-app4 nishanthkp/weather-app:v4

Step 6: Inspect weather-app4:

docker container inspect weather-app4 | grep Cmd
docker container inspect weather-app-nonroot
docker container inspect weather-app4

Step 7: Create the weather-app container:

docker container run -d --name weather-app5 -p 8083:3001 nishanthkp/weather-app:v4 echo "Hello World"

Step 8: Inspect weather-app5:

docker container inspect weather-app5

Step 9: Create the volumes for Prometheus:

docker volume create prometheus
docker volume create prometheus_data
sudo chown -R nfsnobody:nfsnobody /var/lib/docker/volumes/prometheus/
sudo chown -R nfsnobody:nfsnobody /var/lib/docker/volumes/prometheus_data/

Step 10: Create the Prometheus container:

docker run --name prometheus -d -p 8084:9090 \
  -v prometheus:/etc/prometheus \
  -v prometheus_data:/prometheus/data \
  prom/prometheus \
  --config.file=/etc/prometheus/prometheus.yml \
  --storage.tsdb.path=/prometheus/data

Step 11: Inspect Prometheus:

docker container inspect prometheus

Prometheus Dockerfile

https://github.com/prometheus/prometheus/blob/master/Dockerfile

PreviousDockerfile VolumeNextMultiple Stage Build

Last updated 2 years ago