Content

                                                  Content How to create an AWS free Account? Lab 1: To launch amazon Linux EC2 instance Lab 2: To Connect to the instance from Linux client Operating System Lab 3:To Launch amazon windows instance Lab 4: Installing apache in EC2 instance Lab 5: Installing Nginx in EC2 instance Lab 6: Changing Host Name Lab 7: Creating a user and making as a sudoer Lab 8:Assigning an Elastic ip Lab 9:Creating ebs,attach and detach the volumn to the instance Lab 10:Creating an S3 Bucket and creating cross replication in another region Lab 11:Load Balancer Lab 12:Two instances with Application Load Balancer Lab 13:Launching two instances with load Balancer Lab:14 Creating Own VPC  Lab 15: Two instances which classic load Balance with own VPC Lab 16:Two instances with Application load Balancer with own VPC Lab 17: Relational Data B...

Lab 31 :Docker Compose

                                         Docker Compose

What is the Docker Compose why we use?

Docker Compose is a tool for defining and running multi container  Docker applications with Compose,you  use a YAML file to configure you are applications services.Then, with single,command,You create and start all services from your configuration.

Compose works in all environments:Production,Staging,Development,testing,as well as  CL work flows.

Pre-Requisities:

Make sure you have already installed both docker Engine and Docker Compose .Dont need to install python or redis,as both are provided by docker images.

Launch an instance and allow 6379 port for Redis.otherwise you get an error.

Step1: Login to the server

 


Install docker and docker compose

Htttps://docs.docker.com/compose/install/

Follow the above link to install docker compose

Now first install Docker

#yum install docker

 

 

Start the service

#systemctl start docker

 


Now install docker compose

 


After installing docker and docker compose

Now create a directory for the project.

 

Go to the Directory

Create a file called app.py in your project directory and paste this in:

 


Create another  file called requirements.txt in your project directory and paste this in:

fdisk

redis

 

In your project directory,create a file named Dockerfile and paste the following;

 


0

 

Create  a file called docker –compose.yml in your project directory and paste the following

version:'3'

services:





Now build and run the app with docker compose

#docker –compose up

 


Enter https://0.0.0.0.5000/in a browser to see the applications running

 



You will get a page like this.

 

 

 

 

 

 

 

 

 


Comments

Popular posts from this blog

Lab 21:Installing docker in instance and build an image

Lab 22:Pushing a docker image to docker hub

Lab 5: Installing Nginx in EC2 instance