Day 18 Task: Docker for DevOps Engineers

Day 18 Task: Docker for DevOps Engineers

·

2 min read

Docker Compose

Docker Compose is a tool for defining and running multi-container Docker applications. It allows you to define the services, networks, and volumes for your application in a single file, called a "docker-compose.yml" file. This file describes the configuration of your application's services, including the Docker images to use, the ports to expose, and any dependencies between services.

  • With Docker Compose, you can start and stop your application with a single command, as well as manage and scale the different services that make up your application. It also allows you to easily share your application configuration with others, making it easier to collaborate on complex applications with multiple services.

    Overall, Docker Compose simplifies the process of managing complex Docker applications by providing a unified way to define, run, and manage multiple containers.

What is YAML?

  • YAML is a data serialization language that is often used for writing configuration files. Depending on whom you ask, YAML stands for yet another markup language or YAML ain’t markup language (a recursive acronym), which emphasizes that YAML is for data, not documents.

  • YAML is a popular programming language because it is human-readable and easy to understand.

  • YAML files use a .yml

Task

  • adduser
adduser <aman>
su - <user_name>

  • system update
sudo apt-get update

  • Install docker
sudo apt-get install docker.io -y

  • Docker Version
docker --version

  • Pull a pre-existing Docker image from a public repository (e.g. Docker Hub)
sudo docker pull nginx

  • Reboot the machine
sudo docker reboot
  • Run it on your local machine. Run the container as a non-root user
sudo docker run -it --name <container_name> <image_name> /bin/bash

  • Check Docker Container
sudo docker ps -a
sudo docker images

  • Inspect the container's running processes and exposed ports using the docker inspect command
docker inspect <container_id>

  • Docker start commands to start the container.
docker ps -a
docker start <container_id>

  • Use the docker attach to go inside the Container
docker attach <container_id>

Docker stop commands to stop the container.

docker stop <container_id>

  • Use the docker rm command to remove the container when you're done.
docker rm <container_id>

********************************Thank You***************************************