In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article focuses on "how to build a docker image and deploy it in daocloud". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to build and deploy a docker image in daocloud.
Recently, I have been in contact with docker for a day or two, and my personal understanding of docker is
It is a virtual machine for the user
For operators, this virtual machine consumes much less resources than traditional virtual machines.
To be honest, I'm just a user. I don't think about it so much. I just see how to use this virtual machine.
If you use it as a website server, compared with sae, docker is more operable and flexible, just like I can use C language to do a website server. Comparing virtual machines with space is much more convenient. It has unlimited potential. I don't know if I can achieve the freedom of vps.
Of course, docker has more than these benefits. An image is equivalent to an app, just like Android. If you change a phone, you can start the service as long as you download my app and deploy it. Is it very simple? you don't have to repeat a lot of troublesome instructions, and everything is packaged into an app, for example, a button, wordpress can be used, and you don't have to do anything! It's like bringing someone else's virtual machine directly to use. it's as simple as that.
Ok~ said what he understood, try how to use it immediately, and experience the charm of docker in the process of using it.
Let's talk about the process first. don't make a lot of trouble. as long as you haven't used a framework that no one can understand, use a http server in C language.
The http://my.oschina.net/tmj1993/blog/495645 written in the blog before.
Use this as the core content of docker later.
Log in to daocloud first
Create a new project
Connect to my github and specify my own project on github, which was just uploaded to push in the morning.
Https://github.com/ahelloworld/MiniHttpServer
Ok, there are only three files in it.
One is the source file httpserver.c
One is the makefile file, which passes the source file through make all to get the httpserver runnable file.
One is the dockerfile file, which is the key to the application package.
FROM ubuntu / / equivalent installation of a ubuntu core system
MAINTAINER ahelloworld / / it's useless, it's just personal information.
RUN apt-get update / / Update
RUN apt-get-y install gcc make / / install gcc and make, because the system is only core
COPY / / copy the root of my github to the root of the virtual machine
EXPOSE 80 / / Open port 80
When RUN make all / / is copied, it naturally compiles the httpserver.c file in the root directory, compiles it through makefile, and gets a httpserver runnable file.
ENTRYPOINT ["/ httpserver", "80"] / / runnable files are running
Ok!
Let's take a look at the process of making this mirror image.
The deployment time is also very fast, ha. The first step is to find it from cache, and the second step is to pull the source file clone of my github.
The third step of the mirror production, you can expand to see some details, some repetitive operations may be made into cache, and then others can do the same operation to speed up from cache, cloud computing big data and so on? Anyway, a lot of people use it, and it might be very good if the database is very large.
When it comes to entrypoint, the step is to run the program (cmd is also similar). The image has been made before. Under the condition of image, we use this image to provide web service pull through. / httpserver 80. Cmd provides a way to change the running parameters. Entrypoint uses a fixed way, because only port 80 is open, so it is useless to provide variable, or entrypoint starts.
Finally, the mirror image was made.
Once you have an image, you can deploy it at will, just like the relationship between the class and the object, just like the relationship between the mall application and the application on your phone. Make an image and you can deploy it.
There's nothing to say about deployment. Press it twice.
Http://hellodocker-minihttp.daoapp.io/
Provide a website to show you the effect. It will expire from time to time, because this application will take up a quota for me. It is estimated that it will be closed after a period of time.
It's hello docker.
At this point, I believe you have a deeper understanding of "how to build a docker image and deploy it in daocloud". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.