#Day 20 Docker Project

#Day 20 Docker Project

Deploy an nginx:

To stop the container:

To remove the container:

If you want to run Nginx and access it to the system you need to open a port for it. i.e. container ip and host ip should be bound.

Take the public IP and run it.

13.59.211.82:80

Project 2 : Project2: To run react_django_demo_app

How to run the code which has been written by the developer. That information will be stored in README.md

Firstly understand which types of files exist.

.py for Python project.

to RUN - manage.py

requirements will be written in - requirement.txt

DOCKER FILE:

[python install, code copy from system to image, required to install server run]

FROM:

If you are creating any image inside that brings one parent image/base image in that OS is running to create a virtual environment to run Python in this case.

FROM python:3.9 - This is a syntax for a Python file.

COPY:

The code will be in your system and you need to copy it from the system to your container

COPY. (current folder). (Same container) - Copy code from source to destination

RUN :

The requirement file consists of the Django file with all the information. Installation using requirement.txt

RUN pip install -r requirement.txt

CMD :

TO write command

CMD ["python","manage.py","appserver","0.0.0.0:8000"]

Difference between RUN and CMD :

RUN is the command while creating images intermediate steps will be written in RUN.

CMD: Once the image is created that container will create a command which is running for a lifetime that is coming under cmd. written in the form of an array.

From Docker, a docker image will be built.

Giving a tag to that image by -t react-django-app: latest

The image has been created from the docker file

This image will create a container.

Ports opening: