<Docker> 01 Command Parameter Parsing

Source: Internet
Author: User

Recently, the stable version of docker1.0 is released, which injects fresh blood into Paas.

Docker is a powerful automated Distributed System: large-scale Web deployment, database clusters, continuous deployment systems, private paas, and service-oriented architecture.

Docker is a Linux XC iner (lxc) technology that adds advanced APIs and provides a lightweight virtualization solution that can run Unix processes independently.

It provides a way to automatically deploy software in a secure and reusable environment.

Cantgis will explain how docker runs on centos.


The cantgis experimental environment is run in centos7:


1. All docker operations require the root permission and sudo:

docker search centos

2. Download the service image and select the tag.

docker pull centos:centos7

3. view the downloaded Image

docker images

4. Create a container Based on the downloaded Image

docker run -i -t centos:centos7 /bin/bash

Then you enter a container, a new centos7 system encapsulated, and exit the container.

5. view all container

docker ps -a

6. If you download the corresponding image from a private or public docker database, use the build parameter. The parameter [.] is the configuration file. Click,Dockerfile

docker build -t NEW_Images .

7. Build the container according to dockerfile in the current directory [this command applies to creating httpd or nginx services in a container, and publish the ing ports under-P.]

docker run -i -t - p 2013:80

Run a container. The following parameters are supported:

  • -dDetached or daemon mode, which runs in the background.

  • -i -tOpen a putty terminal to maintain the interactive mode. These two terminals are generally used together.

  • -eTo set environment variable parameters, see install gitlab with docker

  • -p [host_port]:[container_port]Maps host ports to containers to facilitate external access to services in containers. host_port can be omitted.

  • -v [host-path]:[container-path]Mount the host folder to the iner to save data.

  • --rmAutomatically delete a container with the same image already running.

8. List the currently running containers,-aWill list all, including stopped,-qOnly list container IDs.

docker ps -a -q | xargs docker rm

This can delete all containers that are not running.

10. Delete the specified iner.

docker rm ContainerID

11. Delete the specified Images

docker rmi imagesID

For more information, see the docker documentation.

The figure below is a very good explanation. Let's take a look at it.

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/45/D7/wKiom1PsZAGC6gmRAAKyXSfmYaE819.jpg "Title =" clipboard.png "alt =" wkiom1pszagc6gmraakyxsfmyae819.jpg "/>


This article is from the "cantgis" blog, please be sure to keep this source http://cantgis.blog.51cto.com/5788192/1539964

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.