Docker simple use, using Ari like

Source: Internet
Author: User

Step one: Make sure Docker is installed:

Step two: Go to the search mirror on Ali

Find the mirror you want, and then click on the Life line in detail, as follows (note the following plus version number, such as: V1.0):

Docker Pull registry.cn-hangzhou.aliyuncs.com/kennygu/centos-java-tomcat:v1.0


Step three: View local mirrors when finished

Docker images


Fourth step: Direct run

Docker Run-p 8080:8080 77ace5f2b10a

Because my resources are official online public library, down to make, this side of the direct run can see the running log, the general clean system is required to install and configure some things.


Step Fifth: Make your own mirror image

1) Login

Dockerlogin--username=xxx registry.cn-hangzhou.aliyuncs.com
2) Production
Note: REGISTRY.CN-HANGZHOU.ALIYUNCS.COM/KENNYGU/CENTOS-JAVA-TOMCA can be modified into your own Ari image Library

3) Upload

Docker Push registry.cn-hangzhou.aliyuncs.com/kennygu/centos-java-tomcat:v1.0  


Docker Common Commands

Docker run < related parameters > < mirroring id> < initial command >
-I: means to run the container in interactive mode
-T: Indicates that the container will enter its command line when it starts
-V: Indicates that the local directory needs to be mounted in the container.
Format:-v < host directory >:< container directory >

($imageid: Dynamic mirror ID) # download an Ubuntu image
sudo docker pull Ubuntu
# use Ubuntu to run an interactive shell
sudo docker run-i-T Ubuntu/bin/bash
#docker PS Command
sudo docker PS #列出当前所有正在运行的container
sudo docker ps-l #列出最近一次启动的, and running container
sudo docker ps-a #列出所有的container
#port命令
Docker run-p 80:8080 <image> <cmd> #映射容器的8080端口到宿主机的80端口
#删除容器命令
sudo docker rm ' sudo docker ps-a-Q ' #删除所有容器

sudo docker rm $CONTAINER _id# remove container with container ID container_id

sudo docker RMI $REPOSITORY: Version number #REPOSITORY删除镜像
sudo docker rmi $imageid #删除镜像
#其他命令快速参考:

sudo docker images #查看本地镜像

Docker start Containerid start a stopped container (containerid: dynamic) sudo docker attach $CONTAINER _id #启动一个已存在的docker实例
sudo docker stop $CONTAINER _id #停止docker实例
sudo docker logs $CONTAINER _id #查看docker实例运行日志 to ensure normal operation
sudo docker inspect $CONTAINER _id #查看container的实例属性, such as IP, etc.
TIPs: When exiting, use [Ctrl + D], which will end Docker the current thread, the end of the container, you can use [Ctrl + P][ctrl + Q] to exit without terminating the container to run



Docker run-p 9411:9411-i-t-d--name kenny-zipkin-server-v






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.