0% found this document useful (0 votes)
12 views7 pages

Assignment 4

Uploaded by

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

Assignment 4

Uploaded by

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

Docker Engine Installation and Verification

Task 1 : Below I have explains how I have installed Docker on a Linux Machine.

Step 1: Update Ubuntu Repositories

Command: sudo apt-get install

Step 2: Install Prerequisites

Command: sudo apt-get install apt-transport-https ca-certificates curl software-properties-common

Step 3: Add Docker's official GPG key

Command: curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add –

Step 4: Add the Docker repository to APT sources

Command: sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu


$(lsb_release -cs) stable"

Step 5: Update the repositories again

Command: sudo apt-get update

Step 6: Install Docker

Command: sudo apt-get install docker-ce

Task2 : Below the explanation of, how did I created a container as a web server and testing it and the
using the port of 8080

Step 1: Create a new directory for Docker project

Commands: mkdir my_web_server , cd my_web_server

Step 2: Dockerfile Creation

Content of the Dockerfile:

FROM ubuntu:latest

# Install apache2

RUN apt-get update && apt-get install -y apache2

# Add a custom web page

RUN echo '<html><body><h1>Hello from Docker!</h1></body></html>' >


/var/www/html/index.html

# Expose the web server port

EXPOSE 8080
# Start apache2 service

CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]

Step4 I have built the docker image by running the built command and then running the container by
running the sudo docker run -d -p 8080:80 name of thee image

Multi-container Docker Application

Firstly Install the docker compose create a directory for your project, I have created a flask and redis
app and I have created docker-compose.yml file for my docker and then start the multi-container
application by running the sudo docker-compose up .

You might also like