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 entrypointcd entrypointStep 2: Clone the image:
git clone https://github.com/nishanthkumarpathi/content-weather-app.git srcStep 3: Create the Dockerfile:
vi DockerfileStep 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/wwwStep 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:v4Step 6: Inspect weather-app4:
docker container inspect weather-app4 | grep Cmddocker container inspect weather-app-nonrootdocker container inspect weather-app4Step 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-app5Step 9: Create the volumes for Prometheus:
docker volume create prometheusdocker volume create prometheus_datasudo 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/dataStep 11: Inspect Prometheus:
docker container inspect prometheusPrometheus Dockerfile
https://github.com/prometheus/prometheus/blob/master/Dockerfile
Last updated