Code Monkey home page Code Monkey logo

docker-study's Introduction

Docker Overview

  • Docker is the worlds leading software container platform.
  • Docker is a tool designed to make it easier to deploy & run applications by using containers.

Installation

docker version
  • Run sample application
docker run hello-world

Images, Containers

  • Docker images are templates used to create docker containers.

  • Containers is running instance of images.

  • See all images

docker images
  • See all containers
docker ps -a
  • See all running containers
docker ps
  • Run docker image
docker run imageName/ID

Create Dockerfile

  • Create dockerfile.

  • Build an image from dockerfile.

  • Create Dockerfile and add these lines in dockerfile

FROM golang:latest
MAINTAINER  "Vikram Ingawale" <[email protected]>
WORKDIR /go/src/app
COPY . .
RUN go get -d -v ./...
RUN go install -v ./...
CMD ["app"]

Build an image from the Dockerfile

  • Build the image using the docker build command.
docker build -t myhelloworld .
  • -t parameter gives tag to yout image.
  • dot(.) at the end means this command reads the Dockerfile from the current directory otherwise specify Dockerfile path.

Create a container from your image & run

  • to create container use command.
docker run -d -p 80:80 imageName
  • -d means run this detached, as a daemon not dependent on the terminal session.
  • -p means map ports.
  • access it with http://localhost:80

Push docker image

  • Create docker hub account.
  • Run command in docker cli
docker login
  • Add a docker tag to image.
docker tag <imageName/ID>  <docker hub username>/<target imageName>:<version or tag>
  • Push your image.
docker push <docker hub username>/<target imageName>
  • Look at your docker hub account. Your image should be there.

  • See images on your machine

docker images

Pull docker image

  • To pull image from docker hub use below commands
docker run -d -p 80:80 <docker hub username>/<imageName>
docker run imageName/ID

Stop running container

docker stop containerName/ID

Remove image

docker rmi -f <imageName/ID>
  • -f is for forcefully delete.

Remove container

docker rm containerName/ID

For more details please refer notes section

docker-study's People

Contributors

vikram1565 avatar

Stargazers

Vijay Ingawale avatar Akshat Mittal avatar Akshay Bharambe avatar

Watchers

 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.