Docker ~ Deployment in linux, docker ~ Linux deployment

Source: Internet
Author: User
Tags docker ps aws cloudformation

Docker ~ Deployment in linux, docker ~ Linux deployment

Docker is a popular container tool recently. It can help us quickly deploy applications, especially in the "microservice" environment. It is too troublesome to start, stop, and deploy hundreds of services once, if you deploy it in docker, the next application will be much more convenient. If you need a few lines of code, you can do it!

Definition of Baidu encyclopedia

Docker is an open-source application container engine that allows developers to package their applications and dependencies to a portable container and then publish them to any popular Linux machine, you can also achieve virtualization. Containers fully use the sandbox mechanism and do not have any interfaces between them.

Application scenarios

Complex Environment Management
From various operating systems to various middleware to various apps, a product can be successful as developers need to care too much and is difficult to manage. This issue needs to be addressed almost all modern IT-related industries.
The arrival of the cloud computing age
The success of AWS has guided developers to migrate their applications to the cloud, solving the hardware management problem. However, problems related to middleware still exist (so both openstack HEAT and AWS cloudformation work hard to solve this problem ). The change in developer thinking provides the possibility.
Changes in virtualization Methods
In the cloud era, standard hardware is used to reduce costs, virtualization is used to meet users' on-demand needs, and availability and isolation are ensured. However, both KVM and Xen are a waste of resources in docker's view, because the user needs an efficient running environment instead of OS. GuestOS is a waste of resources and difficult to manage, more lightweight LXC is more flexible and fast
LXC mobility
LXC already exists in the kernel of linux 2.6, but it was not considered for cloud computing at the beginning of its design. It lacks standardized Descriptive methods and the portability of containers, it is difficult to migrate and standardize the environment (compared with the concepts of image and snapshot such as KVM ). Docker has made substantial innovations on this issue. This is the most unique part of docker.

Deployment on centos

 

1. Install and add service and self-startup items

[Root @ localhost ~] # Yum install docker

[Root @ localhost ~] # Systemctl start docker. service

[Root @ localhost ~] # Systemctl enable docker. service

2. Several Common docker commands

docker ps
To view containers

docker info
Check whether Docker is correctly installed. If this command is not found, it indicates that Docker is not correctly installed.

docker pull busybox
Pull a pre-built Image

sample_job=$(docker run -d busybox /bin/sh -c "while true; do echo Docker; sleep 1; done")
Run hello docker later as a process
The sample_job command prints Docker every second. You can use Docker logs to view the output. If there is no name, the job will be assigned an id. It will be troublesome to use commands such as Docker logs to view logs in the future.

docker help
All Docker commands

docker logs $sample_job
Run the Docker logs command to view the current status of the job:

docker stop $sample_job
Stop a container named sample_job

docker restart $sample_job
Restart the container

docker stop $sample_job docker rm $sample_job
To completely remove a container, stop the container before removing it.

docker commit $sample_job job1
Save the container status as an image

docker images
To view the list of all images

Install the. netCore Image
Download the dotnet Image
Sudo docker pull microsoft/dotnet

Check this image

sudo docker images

This process can be blank, because the download speed above is very slow. After all, it is an old and beautiful server!

Next we will learn how to deploy a netcore website in docker!



 

Related Article

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.