$ -weight: 500;">docker run -d -p 80:80 --name my-nginx nginx
-weight: 500;">docker run -d -p 80:80 --name my-nginx nginx
-weight: 500;">docker run -d -p 80:80 --name my-nginx nginx
# Use the official Nginx base image
FROM nginx:alpine # Copy custom HTML file to the Nginx public folder
COPY index.html /usr/share/nginx/html/index.html # Expose port 80
EXPOSE 80
# Use the official Nginx base image
FROM nginx:alpine # Copy custom HTML file to the Nginx public folder
COPY index.html /usr/share/nginx/html/index.html # Expose port 80
EXPOSE 80
# Use the official Nginx base image
FROM nginx:alpine # Copy custom HTML file to the Nginx public folder
COPY index.html /usr/share/nginx/html/index.html # Expose port 80
EXPOSE 80
-weight: 500;">docker build -t my-custom-nginx .
-weight: 500;">docker build -t my-custom-nginx .
-weight: 500;">docker build -t my-custom-nginx .
-weight: 500;">docker run -d -p 80:80 --name custom-nginx my-custom-nginx
-weight: 500;">docker run -d -p 80:80 --name custom-nginx my-custom-nginx
-weight: 500;">docker run -d -p 80:80 --name custom-nginx my-custom-nginx - Virtual Machines: A VM includes the application, the necessary binaries, and libraries, along with a complete guest operating system (OS) per instance. They tend to use more resources and take longer to -weight: 500;">start since each VM runs a full OS.
- Containers: Containers share the host OS kernel and are lightweight. They encapsulate an application and its dependencies but do not require a full guest OS. This makes containers fast to -weight: 500;">start and -weight: 500;">stop, while also using fewer resources. - -d runs the container in detached mode.
- -p 80:80 maps port 80 of the container to port 80 on the host.
- --name my-nginx gives your container a name.
- nginx specifies the image to use. - List containers: -weight: 500;">docker ps -a
- Stop a container: -weight: 500;">docker -weight: 500;">stop <container_id>
- Remove a container: -weight: 500;">docker rm <container_id>
- View container logs: -weight: 500;">docker logs <container_id> - Docker in CI/CD: Utilize Docker to run your tests and builds in a standardized environment.
- Docker Compose: Use Docker Compose to define multi-container applications in a single -weight: 500;">docker-compose.yml file.
- Continuous Deployment: Push Docker images to a registry (like Docker Hub) and pull them to production to facilitate seamless deployments. - Start by installing Docker Desktop and running your first container.
- Familiarize yourself with Dockerfile syntax to customize your containers.
- Use Docker Compose to manage multi-container applications effectively.
- Integrate Docker into your CI/CD pipelines for improved development efficiency.