Docker: Article 1

Source: Internet
Author: User
Tags docker run

1. Docker Introduction

Docker is based on the go language, followed by the apache2.0 protocol, all source code on the GIT maintenance of open-source projects. The Docker engine is based on the Linux container (LXC) technology. Docker technology can be understood as one of the virtualization technologies, but Docker has significant differences and advantages over the traditional virtual machine approach in running the application:

    • Docker containers are faster, start-up and stop can be implemented in seconds;

    • Docker containers have few requirements for system resources, and thousands of containers can be run on a single host;

    • Docker uses git-like operations to make it easy for users to get, distribute, and update application images;

    • Docker supports flexible automation creation and deployment mechanisms through the Dockerfile configuration file;

    • In addition to running applications, Docker containers do not consume additional system resources;

2. The difference between Docker and traditional virtualization

650) this.width=650; "style=" width:546px;height:270px; "src=" http://s3.51cto.com/wyfs02/M01/6E/8E/wKioL1V_ 1oshico2aaf_rnkyqpw717.jpg "title=" http://owenpan.blog.51cto.com "alt=" wkiol1v_1oshico2aaf_rnkyqpw717.jpg "border = "0" height= "hspace=" 0 "vspace=" 0 "width=" 546 "/>

Traditional virtualization is virtualized at the hardware level, requiring additional virtual machine management applications and virtual machine operating system layers;

Docker containers are virtualized on the operating system level, and are directly multiplexed into the local host's operating system, which is even more lightweight.

3. Docker Installation

Installation Environment:

Description:centos Release 6.6 (Final) release:6.6

Installation:

# yum Install http://mirrors.yun-idc.com/epel/6/x86_64/epel-release-6-8.noarch.rpm# yum install docker-io-y# yum Upgrade Device-mapper-libs

Start the service, the first time you start, you can use-D to see the boot information

# docker -dinfo[0000] +job serveapi (Unix:///var/run/docker.sock)    INFO[ 0000] warning: you are running linux kernel version 2.6.32-504.16.2. El6.x86_64, which might be unstable running docker. please upgrade  your kernel to 3.8.0. info[0000] listening for http on unix   (/var/run/docker.sock)  info[0000] +job init_networkdriver ()                      info[0000] -job  init_networkdriver ()  = OK  (0)             INFO[0000] Loading containers: start.                   &NBSP, ....... ...........
View Docker Information # docker  info View version # docker  version view image information # docker   imagesrepository          tag                  IMAGE ID             CREATED              VIRTUAL SIZEcentos               6                    b9aeeaeb5e17        7 weeks  ago         202.6 mbcentos               centos6              b9aeeaeb5e17        7 weeks ago          202.6 MBcentos               7                    fd44297e2ddb        7 weeks  ago         215.7 mbcentos               centos7              fd44297e2ddb        7 weeks  ago         215.7 mbcentos               latest               fd44297e2ddb        7 weeks ago          215.7 mbrepository: from which warehouse tag: Mirror tag information tmag id: Mirror unique ID number created: Creation time Size: Mirror size Get Latest mirror # docker pull centos find all mirrors that meet the keyword # docker search apacheame                    description                                       STARS   OFFICIAL   AUTOMATEDtomcat                apache tomcat is an open  source implementa...   161     [OK]        tutum/apache-php&nBsp;    apache+php base image - listens in port 80 ...    7       [OK]httpd                 the apache http server project                   72       [OK]       maven                 apache maven is a  software project managem...   36      [OK]      Get the image # docker pull appcontainers/apache remove the mirror # docker rmi  Image name or ID view all mirrors # docker ps -a View the currently running mirror # docker ps upload mirror # docker push  mirror name

4. Create a mirror

    • Create a container based on an existing image

    • Import based on local template

    • Create based on Dockerfile

# docker Run-t-I centos:centos7/bin/bash (run a container, exit the container will close) # Docker commit-m= "Apache Server"-a= "Centos7" Ce6323e894ac CENTOS7:APACHE-M: Submit Comment Information-a= "CENTOS7": Original image Identity Ce6323e894ac: Original image of IDcentos7: New warehouse name Apache:tag identity

5. Containers

Creating a container # docker  create -it  CENTOS6717626A62A8757AD1A6BB0F41F854874F81DD4E24AB11387FAA621EEB430AB1 Start the container # docker  start The  6717626a62a86717626a62a8docker create command is used to create a new container in the stopped state, starting it with Docker start;docker run  Create and Start container termination container # docker stop  container name or ID enter container # docker  attach owen[[email  protected] /]#  View all the containers # docker  ps -acontainer id         IMAGE                COMMAND             CREATED              STATUS                         ports              &nbsp names6717626a62a8        centos:7              "/bin/bash"          11  minutes ago      exited  ( 6 minutes ago  )                       focused_heisenberg   30a88aca6232         centos:6             "/bin/bash"           16 minutes ago      exited   (0)  15 minutes ago                         goofy_wright          be70c05068a5        centos:6              "/bin/bash"           22 hours ago        Exited  ( 22 ) hours ago                         lamp                  489f88943530         centos:7             "/bin/bash"           24 hours ago         exited  (0)  51 seconds ago                         owen                   Start a container   [[email protected] docker]#  DOCKER  START 30A30A View the currently started container [[Email protected] docker]# docker  ps  CONTAINER ID        IMAGE                COMMAND              CREATED              status              ports                names30a88aca6232         centos:6              "/bin/bash"         16 minutes ago       Up 6 seconds                             goofy_wright          Enter the container [[email protected] docker]# docker exec  -ti 30a /bin/bash


Docker: Article 1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.