Images
Image is a standalone executable package which contains all necessary to run the application.
Dockerfile
Dockerfile is a “set of rules” to create and run image … to dockerize an app.
Example:
FROM node:22.14.0-alpine3.21
WORKDIR /app
COPY ./app
RUN npm install
EXPOSE 3000
CMD ["npm", "start"]
List local images: docker images
Build docker file: docker build -t <name> .
Remove image: docker rmi <image_id | image_name >
Containers
Container is the running instance of the image.
Container is always running the same independently on the host environment… it’s isolated.
Run image (and create container): docker run -p host_port:container_port <image_name or id>
List running containers:docker ps
List all containers (incl. exited):docker ps -a
Remove stopped container: docker rm <container_name or id>
Start | stop container: docker start | stop <container_name or id>
View resource usage: docker container stats
Leave a Reply