Posts By admin (3)

Docker Command

#install mmongodb using docker image

>docker images
>docker pull mongo:latest
>docker run -d -p 27017:27017 -v ~/mongodb-folder:/data/db --name mymongo mongo:latest
>docker ps
>docker exec -it mymongo bash
>show dbs
>mongo localhost:2717
>docker rm container_id -f
>docker stop container_id
>docker kill -f container_id
>docker rmi -f container_id

#Dockerize Python(Fastapi) project

step1: Create Dockerfile

write given below code in Dockerfile

From python:3
#Create direcotry

#Copy source code if forder not created then ADD filename filename , COPY filename .

COPY . .
Run pip install -r requirements.txt


CMD ["source", ".env"]
CMD ["uvicorn", "src.main:app", "--host==", "--port=8000", "--reload"]

Step2: make docker build

>docker build -t dockermypythonpro
>docker run -p 8000:8000 dockermypythonpro

Vim Command

1. Insert mode (Where you can just type like normal text editor. Press i for insert mode)

2. Command mode (Where you give commands to the editor to get things done . Press ESC for command mode)

Most of them below are in command mode

x - to delete the unwanted character

u - to undo the last the command and U to undo the whole line

CTRL-R to redo

A - to append text at the end

:wq - to save and exit

:q! - to trash all changes

dw - move the cursor to the beginning of the word to delete that word

2w - to move the cursor two words forward.

3e - to move the cursor to the end of the third word forward.

0 (zero) to move to the start of the line.

d2w - which deletes 2 words .. number can be changed for deleting the number of consecutive words like d3w

dd to delete the line and 2dd to delete to line .number can be changed for deleting the number of consecutive words

What is PIP?

PIP stands for "preferred installer program". It is package management system used for install Python and manage the software.