Docker Beginner's Tutorial

Source: Internet
Author: User
Tags docker run

maybe a lot of people The concept of Docker is unclear , but it is clearto Vmvare, Xen,and KVM, and I say the difference between the two

In layman's words, if you want to install an application in a virtualized environment, you must install the operating system in the virtual machine before you can install the software, and Docker does not need to install the operating system, just run Docker image and install the software on the image .

    • image of Docker

Run Docker 's premise is to have dockerimage, just like running a virtual machine requires an operating system, of course, Docker image is not a real operating system image, size is only about 200M, the way to get the Docker image is to download it from the official website

    1. get the image from the website warehouse ,

Docker has its own network image warehouse to provide downloads, of course, you can upload their own good image.

If you have The Linux system is CentOS, you use centosimage

Docker Search CentOS -

###### Search the Web warehouse CentOS Mirror List

650) this.width=650; "Width=" 554 "height=" 225 "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd; "alt=" Spacer.gif "/>

Docker Pull CentOS

######### Download the name "CentOS" of the Image

650) this.width=650; "Width=" 387 "height=" "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ( "/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd; "alt=" Spacer.gif "/>

Docker Images

######## List existing local images, including the downloaded  

650) this.width=650; "width=" 551 "height=" "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd; "alt=" Spacer.gif "/>

2. make your own image

most web-downloaded imagedoes not include the actual software required, so you need to customize it yourself. Your own production is a network-based download of the image, through the dockerfile file

2.1 Create a new dockerfile file and edit it (the file name must be dockerfile),

The file content complies with the following format:

From centos:6.6

#####  based on centos:6.6. Mirror

Maintainer Zhang

#####   Creator Information

RUN Yum install-y postfix

########   installation postfix

RUN Yum install-y openssh-server

######### installation SSH

EXPOSE 22

######## Open A Port

EXPOSE 25

######### Open - Port

2.2 generating Mirrors

path to Docker build-t= "Mailsrv/centos" Dockerfile

#-T generate a label for the newly created image

two , The operation of Docker:

Start Container:

Docker Run–i–t Mailsrv/centos/bin/bash

######-T option lets Docker assign a pseudo terminal (Pseudo-tty) and bind it to the container's standard input .

#####-I. keep the container's standard input open to start a bash terminal

650) this.width=650; "Width=" 475 "height=" of "src=" "/e/u261/themes/default/images/spacer.gif" style= "Background:url" ("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd; "alt=" Spacer.gif "/>

This creates an interactive connection to the container, which means that we are inside the container and can operate, such as installing software, system configuration, etc.

To view previously installed software

650) this.width=650, "width=" 378 "height=" "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ( "/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd; "alt=" Spacer.gif "/>


Docker Beginner's Tutorial

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.