Home > Article > Operation and Maintenance > How to use docker on ecs (tutorial)
With the development of cloud computing technology, cloud servers (ECS) have become an indispensable part of Internet enterprise operation and maintenance. As a fast and convenient containerization technology, Docker has gradually become a popular choice for enterprise development and operation and maintenance. This article will introduce how to use Docker on Alibaba Cloud ECS.
1. Purchase ECS
First, you need to purchase an ECS instance in the Alibaba Cloud console. You need to select an operating system when purchasing. It is recommended to choose the CentOS 7.X version here because Docker has better support for CentOS 7.X. After successful purchase, you need to log in to the ECS instance.
2. Install Docker
sudo yum update
sudo yum install docker
sudo service docker start
sudo chkconfig docker on
3. Docker commonly used Command
sudo docker search tomcat
sudo docker pull tomcat:9.0
sudo docker images
-p
parameter maps the 8080 port to the 8080 port of the ECS instance: sudo docker run -d -p 8080:8080 --name tomcat9 tomcat:9.0
sudo docker ps
sudo docker stop 容器ID或容器名
sudo docker rm 容器ID或容器名
4. Solutions to common problems
sudo usermod -aG docker 用户名
sudo yum install iputils -y
Summary
It is very convenient to use Docker on Alibaba Cloud ECS. You only need to purchase an ECS instance and install Docker. . By studying this article, you have learned how to use Docker on ECS and learned solutions to some common problems. I hope it will be helpful to your work and study.
The above is the detailed content of How to use docker on ecs (tutorial). For more information, please follow other related articles on the PHP Chinese website!