Docker using Ansible
Jul 7, 2021
Install and configure Docker and run a web server in the docker container.
In this blog, I will demonstrate how I created an Ansible Playbook that can perform the following operations:
- Configure Docker on Centos 8 or RedHat 8
- Start and enable Docker services
- Pull the httpd server image from the Docker Hub.
- Run the Docker container and expose it to the public
- Copy the HTML code in /var/www/html directory and start the webserver.
Now we can run the playbook:
$ ansible-playbook docker_conf_httpd_webserver.yml
The playbook ran successfully.
Let’s browse the index.html page in the webserver running on Docker Container.
GitHub: https://github.com/mtabishk/ansible-playbooks/tree/main/docker
That’s all for today! I’ll be back with some new articles very soon, thanks! 🤗
Muhammad Tabish Khanday
LinkedIn: https://www.linkedin.com/in/mtabishk/