Giter Site home page Giter Site logo

docker_notes's Introduction

Docker Notes

Contains a list of simple docker commands.

Toable of Content

  • docker images List all the docker images.

  • docker ps List all the running containers.

  • docker ps -a Lists all the containers runnning + stopped

  • docker pull <image_name>:<version> Pull the image from Docker hub of the specified version

  • docker pull <image_name> Same as before but teh version is "latest" which is the default version is pulled from the DockerHub.

Run a container Back ⇈

  • docker run <image_name>:<tag> Runs the container for the docker image. Please note:
  1. Docker will look for the image locally, and if not found then it will look for it in the docker hub. If found, it will pull it and then run it.
  2. It creates a new container each time.
  • docker run -d <image_name>:<tag> Runs the container in detached mode. The process is not blocking the terminal. The container runs in the background.

  • docker run -d -p <local_machine_port>:<application/docker container_port> <image_name>:<tag> Port binding - Binds the container to a port on the local machine so it can be accessed.

  • docker run --name web-app -d -p <local_machine_port>:<application/docker container_port> <image_name>:<tag> flag --name It is used to give a custom name to the container.

  • docker start <container_id> or <container_name> Restarts the exited/stopped container.

  • docker stop <container_name> or <container_id> Stops the container with the given id or name.

  • docker logs <container_id> or <container_name>` View logs of the container.

Build Back ⇈

  • docker build -t <image_name>:<tag> . // or --tag = and "." refers to the current folder build a custom docker image.

Clean up Back ⇈

  • docker container prune Delete all the stopped containers

  • docker image rm <image_name>:<tag> Delete the docker image

docker_notes's People

Contributors

5abhisheksaxena avatar

Watchers

 avatar  avatar

docker_notes's Issues

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.