In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
The URLOS developer function has been online for some time. According to the experience of some developers, we have to say that URLOS does have unique advantages in server software development efficiency. With docker container technology and its good application ecological environment, URLOS will quickly become the new darling of software developers.
This article is based on the introduction, through the production of a simple static website environment application, so that new developers can have an understanding of the development process of URLOS in a short time.
URLOS is based on docker container technology, so we can't do without the relevant commands of docker in the process of application development. Friends who don't know much about docker can get a general idea of docker first. We won't discuss it in detail in this article.
The basic flow of URLOS application development
The goal of this article is to create a nginx static website environment, so what we need to do is to run a basic image, install nginx based on this image, set up the website root directory, package and upload a new image, add new applications through URLOS, publish and export applications.
Create nginx static website environment 1. Pull the basic image of Alpine
Why choose Alpine as the base image? Because the file size of Alpine is small, the basic image is only 5.53MB, which is ten times smaller than the 88.9MB of ubuntu image.
Use the docker pull alpine command to pull the alpine image:
Root@ubuntu:~# docker pull alpineUsing default tag: latestlatest: Pulling from library/alpinebdf0201b3a05: Pull completeDigest: sha256:28ef97b8686a0b5399129e9b763d5b7e5ff03576aa5580d6f4182a49c5fe1913Status: Downloaded newer image for alpine:latestroot@ubuntu:~#
Then use the docker images command to view the image:
Root@ubuntu:~# docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEurlos/urlos latest 4810506f7202 12 hours ago 447MBalpine latest cdf98d1859c1 2 weeks ago 5.53MBroot@ubuntu:~# II, update image, install nginx
Run the Alpine image and enter the container:
Root@ubuntu:~# docker run-it alpine sh/ #
Replace the update source:
/ # vi / etc/apk/repositories
Replace the content with the source of Aliyun
/ # cat / etc/apk/repositories https://mirrors.aliyun.com/alpine/v3.6/main/https://mirrors.aliyun.com/alpine/v3.6/community// #
Use apk update to perform the update:
/ # apk updatefetch https://mirrors.aliyun.com/alpine/v3.6/main/x86_64/APKINDEX.tar.gzfetch https://mirrors.aliyun.com/alpine/v3.6/community/x86_64/APKINDEX.tar.gzv3.6.5-25-g77eea063d8 [https://mirrors.aliyun.com/alpine/v3.6/main/]v3.6.5-18-gfdfe1f6192 [https://mirrors.aliyun.com/alpine/v3.6/community/]OK: 8453 distinct packages available/ #
Install nginx using apk add nginx:
/ # apk add nginx (1amp 4) Installing libressl2.5-libcrypto (2.5.5-r2) (2max 4) Installing pcre (8.41-r0) (3pm 4) Installing libressl2.5-libssl (2.5.5-r2) (4pm 4) Installing nginx (1.12.2-r2) Executing nginx-1.12.2-r2.pre-installExecuting busybox-1.29.3-r10.triggerOK: 9 MiB in 18 packages/ #
Protect pid:
/ # cd / run//run # mkdir nginx
Add the site root directory:
/ # mkdir-p / data/www/
Modify the nginx configuration file:
/ data/www # vi / etc/nginx/conf.d/default.conf/data/www # cat / etc/nginx/conf.d/default.conf# This is a default site configuration which will simply return 404, preventing# chance access to any other virtualhost.server {listen 80 default_server; listen [::]: 80 default_server; location / {index index.html; root / data/www } # You may need this to prevent return 404 recursion. Location = / 404.html {internal;}} / data/www #
Test nginx:
/ data/www # nginx-tnginx: the configuration file / etc/nginx/nginx.conf syntax is oknginx: configuration file / etc/nginx/nginx.conf test is successful
OK,nginx configuration is complete!
Use exit to exit the container and prepare to package the image.
/ data/www # exitroot@ubuntu:~# 3. Package image
Use the command docker ps-a to view all containers:
Root@ubuntu:~# docker ps-aCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESa5249fa1d7ec alpine "sh" 35 minutes ago Exited (0) 2 minutes ago Youthful_heisenberg1502c4163c2c urlos/urlos:latest "sh / entrypoint.sh" 2 hours ago Up 2 hours 0.0.0.0 entrypoint.sh 9001-> 9001/tcp 0.0.0.0 9966-> 9966/tcp, 0.0.0.0pur9968-> 9968/tcp urlosroot@ubuntu:~#
Use the docker commit command to package the image, and then use the docker images command to view the image:
Root@ubuntu:~# docker commit a5249fa1d7ec yeqing112/alpine-nginx:0.0.1sha256:4730bd89ee3e9408f0ba29c5c80ad0a13600b82de565bbc49f3d4ec8585902c4root@ubuntu:~# docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEyeqing112/alpine-nginx 0.0.1 4730bd89ee3e 13 seconds ago 10MBurlos/urlos latest 4810506f7202 13 hours ago 447MBalpine Latest cdf98d1859c1 2 weeks ago 5.53MBroot@ubuntu:~#
OK, we have successfully created a new image called yeqing112/alpine-nginx.
4. Upload image
First, use the command docker login to log in. If you do not have a docker account, please register on the docker official website:
Root@ubuntu:~# docker loginAuthenticating with existing credentials...WARNING! Your password will be stored unencrypted in / root/.docker/config.json.Configure a credential helper to remove this warning. See https://docs.docker.com/engine/reference/commandline/login/#credentials-storeLogin Succeededroot@ubuntu:~#
Use the docker push command to upload the image:
Root@ubuntu:~# docker push yeqing112/alpine-nginx:0.0.1The push refers to repository [docker.io/yeqing112/alpine-nginx] bbe56e36ea7a: Pusheda464c54f93a9: Mounted from library/alpine0.0.1: digest: sha256:94c5f0c38a3de543cde52791b3daff3fdc8001e99bf58bb08230b2cab3e062a3 size: 739root@ubuntu:~#
Open the docker image warehouse to see the image we uploaded.
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.