In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
This article is about how the Linux operating system builds Docker on ECS. The editor thought it was very practical, so I shared it with you as a reference. Let's follow the editor and have a look.
Build Docker (CentOS7) on ECS
This article describes the deployment process of Docker on the CentOS system. For the installation of Docker under Ubuntu system, please refer to the docker practice document.
Applicable object
It is suitable for developers who are familiar with Linux operating system and are just starting to use Aliyun ECS.
Main content
Deploy docker
Basic usage of docker
Mirror image production
Deploy Docker
This document mainly describes the steps of manually installing docker. You can also choose to purchase the corresponding image in the cloud market and deploy the CVM with one click.
The practical operating system version of this paper is CentOS 7.264 3.10.0-514.6.2.el7.x86_64.
Docker requires a 64-bit system with at least 3.10 kernel version
Add a yum feed.
# yum install epel-release-y # yum clean all# yum list
Install and run Docker.
# yum install docker-io-y # systemctl start docker
Check the installation results.
# docker info
The following xin message indicates that the installation was successful.
Basic usage of Docker
Docker daemon management.
# systemctl start docker # run the Docker daemon # systemctl stop docker # stop the Docker daemon # systemctl restart docker # restart the Docker daemon
Mirror management. This article uses an Apache image from Ali Cloud Warehouse.
# docker pull registry.cn-hangzhou.aliyuncs.com/lxepoo/apache-php5
Modify the tag. Because the image name of Ali Cloud Warehouse image is very long, you can modify the image tag in order to remember the difference.
# docker tag registry.cn-hangzhou.aliyuncs.com/lxepoo/apache-php5:latest aliweb:v1
View existing mirrors.
# docker images
Force the mirror to be deleted.
# docker rmi-f registry.cn-hangzhou.aliyuncs.com/lxepoo/apache-php5
Container management.
E121d5f99e1e is the IMAGE ID queried by executing the docker images command and entering the container using the docker run command.
# docker run-ti e121d5f99e1e / bin/bash
Use exit to exit the current container.
The run command with the-d argument allows you to run the container in the background, and-name specifies that the container is named apache.
# docker run-d-name apache e121d5f99e1e
Enter the container running in the background.
# docker exec-ti apache / bin/bash
Mirror the container.
# docker commit containerID/containerName newImageName:tag
In order to facilitate testing and recovery, first run the source image and then do a simple named image for testing.
# docker commit 4c8066cd8c01 apachephp:v1
Run the container and map the host's port 8080 to the container.
# docker run-d-p 8080VR 80 apachephp:v1
Enter the host ip plus port 8080 access test in the browser, and the following indicates that the operation is successful.
Mirror image production
Prepare the dockerfile content.
# vim Dockerfile FROM apachephp:v1 # declare the basic image source MAINTAINER DTSTACK # declare the commands that the owner of the image RUN mkdir / dtstact # RUN needs to execute before the container runs. Since the Dockerfile file cannot exceed 127lines, it is recommended to write the ENTRYPOINT ping www.aliyun.com # boot command to the script when there are too many commands. The last command here needs to be a command that can be continuously executed in the foreground. Otherwise, the container background runtime will exit because the command has been executed.
Build an image.
Docker build-t webcentos:v1. #. Is the path to the Dockerfile file. You cannot ignore docker images # to check whether docker run-d webcentos:v1 # backend runs the container docker ps # View the currently running containers docker ps-a # View all containers, including docker logs CONTAINER ID/IMAGE # that is not running, if you do not see the container you just ran Check the startup log docker commit fb2844b6c070 dtstackweb:v1 # commit with the container id or name, followed by the container id and the name and version number of the new image. Docker images # list local (downloaded and locally created) images docker push # push the image to the remote repository, default is Docker Hub
Push the image to registry.
Docker login-username=dtstack_plus registry.cn-shanghai.aliyuncs.com # enter the image repository password docker tag [ImageId] registry.cn-shanghai.aliyuncs.com/dtstack123/test: [image version number] docker push registry.cn-shanghai.aliyuncs.com/dtstack123/test: [image version number] Thank you for reading! On the Linux operating system on the ECS to build Docker method to share here, I hope the above content can be of some help to you, so that you can learn more knowledge. If you think the article is good, you can share it and let more people see it.
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.