Docker Use Cases

Karan Agrawal
3 min readJan 17, 2021

Docker:

Docker is an open platform for developing, shipping, and running applications. Docker enables us to separate our applications from our infrastructure so we can deliver software quickly. With Docker, we can manage our infrastructure in the same way we manage our applications.

By taking advantage of Docker’s methodologies for shipping, testing, and deploying code quickly, we can significantly reduce the delay between writing code and running it in production.

In this article, we will:

  • Configure HTTPD Server on Docker Container
  • Set Up Python Interpreter and running Python Code on Docker Container

Setting Up Docker

  • Set up repo for docker-ce Software.
    “vi /etc/yum.repos.d/<reponame>.repo”
  • Install the docker-ce software.
    “yum install docker-ce — — no-best”
  • Start the service.
    “systemctl start docker”

We can see docker service is now running.

Launching a Docker Container

We can see there are no Docker Container and Images Present.

  • Pull an Image of which we want to launch the container.
    “docker pull <image name>”
  • Launch the Container.
    “docker run -i -t — — name <container name> <image name>”

We can see our container OS Build Info.

Configuring HTTPD Server on Docker Container

  • Install the httpd Software.
    “yum install httpd”
  • Set up web pages.
    “vi /var/www/html/index.html”
  • Start the Service.
    As “systemctl start httpd” do not work, use “/usr/sbin/httpd”

We can see Web Service is Working Great.

Setting Up Python Interpreter and running Python Code on Docker Container

  • Install python3.
    “yum install python3”
  • Write Python Code.
    “vi <filename>”
  • Run code.
    python3 <filename>”

We can see our code is working.

For Github Link, click here.

Done with the help of:
- Arunava Mitra
- Tejas Sanghai

--

--