docker pull: Pulls a Docker image from a registry (like Docker Hub).docker run: Runs a container from a Docker image.docker ps: Lists all running containers.docker build: Builds a Docker image from a Dockerfile.docker stop: Stops a running container.docker rm: Removes a stopped container.docker rmi: Removes a Docker image.docker logs: Fetches the logs of a container.docker exec: Runs a command in a running container.Example of a simple Dockerfile for a Node.js application:
# Use an official Node.js runtime as a parent image
FROM node:14
# Set the working directory in the container
WORKDIR /usr/src/app
# Copy the package.json and package-lock.json files
COPY package*.json ./
# Install dependencies
RUN npm install
# Copy the rest of the application code
COPY . .
# Expose the application port
EXPOSE 8080
# Define the command to run the application
CMD ["node", "app.js"]