Day 18 Task: Docker for DevOps Engineers

Day 18 Task: Docker for DevOps Engineers

Day 18 Task: Docker for DevOps Engineers

Till created Docker file and pushed it to the Repository. Let's move forward and dig more into other Docker concepts.


Docker Compose

  • Docker Compose is a tool that was developed to help define and share multi-container applications.
  • With Compose, we can create a YAML file to define the services and with a single command, can spin everything up or tear it all down.
  • To learn more about docker-compose?visit here


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 or .yaml extension.
  • Read more about it?here


How to run Docker commands without sudo?

  • Make sure docker is installed and the system is updated (This is already been completed as a part of previous tasks):
  • sudo usermod -a -G docker $USER
  • Reboot the machine.


Install Docker Compose


$ sudo curl -L https://github.com/docker/compose/releases/download/1.21.0/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
$ sudo chmod +x /usr/local/bin/docker-compose
        


Task-1

Learn how to use the docker-compose.yml file, to set up the environment, configure the services and links between different containers, and also to use environment variables in the docker-compose.yml file.

Sample docker-compose.yaml file

No alt text provided for this image
No alt text provided for this image

Task-2

  • Pull a pre-existing Docker image from a public repository (e.g. Docker Hub) and run it on your local machine. Run the container as a non-root user (Hint- Use?usermod ?command to give user permission to docker). Make sure you reboot instance after giving permission to user.

No alt text provided for this image

  • Inspect the container's running processes and exposed ports using the docker inspect command.

No alt text provided for this image
No alt text provided for this image


  • Use the docker logs command to view the container's log output.

No alt text provided for this image



  • Use the docker stop and docker start commands to stop and start the container.

No alt text provided for this image
No alt text provided for this image


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

No alt text provided for this image


For reference you can watch this?video

要查看或添加评论,请登录

Manish Negi的更多文章

社区洞察

其他会员也浏览了