0% found this document useful (0 votes)
33 views

Docker: How To Setup Docker & Run Apps in Docker

This document discusses how to deploy a Python "Hello World" application as a Docker container. It describes setting up Docker in Ubuntu, creating the Python project, and the Dockerfile, docker-compose.yml, and other files used. Key steps include building the Docker image with "docker-compose build" and running the container with "docker-compose up". The document provides instructions and an overview of the process to containerize a Python application with Docker.

Uploaded by

Deepak G
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

Docker: How To Setup Docker & Run Apps in Docker

This document discusses how to deploy a Python "Hello World" application as a Docker container. It describes setting up Docker in Ubuntu, creating the Python project, and the Dockerfile, docker-compose.yml, and other files used. Key steps include building the Docker image with "docker-compose build" and running the container with "docker-compose up". The document provides instructions and an overview of the process to containerize a Python application with Docker.

Uploaded by

Deepak G
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Docker

How to setup docker & run apps in docker


Setting up Docker in Ubuntu
• Refer the official documentation to setting up the environment
• https://docs.docker.com/install/linux/docker-ce/ubuntu/

• After the installation is complete, run the command docker --version


to check if the docker is installed successfully
Create a Project to Deploy
Here for the demo purpose, a python hello world project is created with its base URL
returning “Hello World” as response. The app is tested & working in local environment.
Now this needs to be deployed as a docker container.

Project : https://github.com/itsparser/code-tool

Following are the steps to create the docker image & run in a container
Structure/Files of the Project
The project mentioned in the previous slide contains the below listed files
• main.py -- Entry point for python application
• Dockerfile -- Docker file for building Ubuntu Image which contains the project code
• Dockerfile-runner -- Extending the ubuntu image generated in previous step & contains the
entrypoint for starting the project
• docker-compose.yml -- docker compose file which specifies the configuration for creating the
images using the above docker files
• requirements.txt -- requirements file contails the dependencies for project, used by the
Dockerfile while setting up the ubuntu environment
Building the Docker Image
• Execute the command “docker-compose build” to build the images
specified in the docker-compose.yml. [Note : If the file name is different
it needs to be externally specified like “****COMMAND HERE*****” ]
• Running the above command will first build the images which doesn't
have any dependency on other images being build parallely [here
testing/base] & then those images which depends on the previous
images will be build [here testing/service]
• The docker-compose.yml file contains the configuration with mapping
for the binding port in host machine with the ports in which the app
runs in the container
• So the command executed in the step 1 will build the image with
these configurations
• To start the application, execute the command “docker-compose up”
Thank You.

You might also like