Giter VIP home page Giter VIP logo

docker-and-kubernetes's Introduction

Docker and Kubernetes

What is Docker?

  • Docker is a tool for running applications in an isolated Enviroment.
  • Similar to Virtual Machine
  • App run in same enviroment
  • Standard for Software Deployment.

⬇️ Install a specific Images.

I am using Nginx but you can choose any there are multiple options like alpine,mongo and many more.

docker run --name nginx -d nginx or docker run postgres:9.6 or docker run nginx:latest

-d : detach mode

🏃‍♂️ Run Docker Container

docker container run --publish 80:80 --detach --name webhost nginx

or

Exposing One Container to Different Ports 🔌:

docker container run -d -p 8080:80 -p 3000:80 nginx:latest

📝 List all Docker Containers

docker container ls -a or docker container ps -a

✔️ Checks logs

docker container logs webhost

✔️ Check Inner Docker Working

docker container top webhost

🔨 Remove Docker Container

docker container rm [Container_Id] or docker rm $(docker ps -aq)

Note: You can specify multiple Container Id to remove multiple Container but you cannot remove a running container due to safety measures.

Container ID looks like : 08gf345hjkmn but you can specify only first three letters of container to remove or to do various operations.

docker container rm 06e 9fd

To remove the running container you can use:

docker container rm -f 06fe

Docker: Volumes

  • Allow Sharing of Data,Files and Folder
  • Between host and container
  • Between containers

docker run --name website -v ${pwd}:/usr/share/nginx/html:ro -d -p 8080:80 nginx

-v : volume

Volume between Container

docker run --name website-copy --volume-from website -d -p 8081:80 nginx

Note: website-copy and website are name of Containers

Dockerfile

FROM python:3.7-buster
COPY . /app
EXPOSE 5000
WORKDIR /app
RUN pip install -r requirements.txt
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "5000"]

Build your Docker Image Using:

docker build --tag website:latest .

This file is the copy of one of my ml project this is the way we create a dockerfile, dockerfile allow us to run all docker commands in one go.

docker-and-kubernetes's People

Contributors

dark-art108 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.