In this tutorial, we'll show you how to set up, install, and run Docker on an Alibaba Cloud Elastic Compute Service (ECS) instance.
Alibaba Cloud's Elastic Compute Service (ECS) is a range of elastic cloud-based server products that are simpler and more efficient to manage than physical servers. You can create instances, add memory to scale up when required, build out connected VPCs in different regions, and use them as essential components of Alibaba Cloud's vast range of cloud products and services.
Docker is a management tool that allows you to develop, deploy, and run applications inside containers. This process is known as containerization.
A Docker container is launched by running a Docker image. A Docker image is an executable package that includes everything needed to run an entire application: code, runtime, any libraries required, environment variables, and configuration files. A container is a runtime instance of a Docker image.
You can run many containers at the same time on the same host machine. These containers are managed by Docker instead of the OS hypervisor. Containerization means that applications run in total isolation from each other. However, you can also configure ports for communication between running containers. In contrast, Virtual Machines take up significant computational power from the host machine and most often have far too many resources than required.
Docker is lightweight and efficient and can manage the most complex applications. You can build Docker containers locally, deploy them to the cloud, and run them anywhere, scaling up when necessary.
Docker is easy to set up, install, and run. Let's check it out.
You will need an Alibaba Cloud account. If you don't already have one, head over to the Free Trial page to get started.
First, let's spin up an Alibaba Cloud ECS instance. Go to the Elastic Computer Service product page and select your region. When you're ready, click Create Instance.
Choose your basic configuration settings.
Select the OS type. We'll use Ubuntu 16.04.
Then click Next: Networking.
We'll keep the defaults and click through to Next: System Configurations.
Set a password to login to the instance as root. Then click through to Next: Grouping.
Leave this as is and click through to Next: Preview.
Check the details, agree to terms, and click Create Instance.
Click through to the Console. You will see your instance spinning up.
Once your instance is running, you can login to it via the terminal with the root user and the password you set previously.
Now we're ready to install Docker. We'll continue working with root access but it's a good idea to set up a less privileged user in Ubuntu at this point. If you do so, you will need to sudo your commands.
It's also a good idea to do the requisite
apt-get upgrade, and
apt-get dist-upgrade processes now too.
To install Docker, first we have to add some required packages, add the GPG privacy guard key, add the repository to sources, and
apt-get update for good measure. Run the following commands:
apt-get install apt-transport-https ca-certificates curl software-properties-common curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable" apt-get update
Now install Docker.
apt-get install docker-ce
Check Docker is running on Ubuntu.
systemctl status docker
We now have a running Docker application and we can pull Docker images down from the DockerHub repositories.
Let's run the hello-world Docker image. Run the following command:
docker run hello-world
You can see that Docker can't find the Docker image locally as we have not pulled it down before, so it goes ahead and pulls the image from the Docker official repositories.
When the pull is complete, it can run the image.
Check out the range of images you have free access to and can run in Docker containers on the DockerHub website.
You can now create a Docker user account and manage your own repositories.
To summarize, we followed some prerequisite steps and logged into our account on Alibaba Cloud. Next, we built an Ubuntu instance with Alibaba Cloud's Elastic Compute Service (ECS) and logged into it via ssh.
We then followed some steps to configure Ubuntu and make it ready for installing Docker. We installed Docker and ran the
If you are planning on running a cluster of containers for a production environment, don't forget to check out the Alibaba Cloud Container Service package. Alibaba Cloud Container Service is a high-performance container orchestration service that helps you easily scale and manage both Docker containers and Kubernetes on your ECS instances. Container Service supports a one-click deployment of container clusters, eliminating the need for you to install and operate your own container orchestration software. It also integrates with Alibaba Cloud's suite of virtualization, storage, network, and security products.
Keep an eye out for more exciting tutorials on Alibaba Cloud's products and services at www.alibabacloud.com/getting-started.
Alibaba Clouder - October 3, 2018
Alibaba Clouder - July 17, 2018
Alibaba Clouder - September 21, 2018
Alibaba Clouder - October 11, 2018
Alibaba Clouder - January 10, 2019
Alibaba Clouder - October 30, 2018
A secure image hosting platform providing containerized image lifecycle managementLearn More
A high-performance container manage service that provides containerized application lifecycle managementLearn More
An online computing service that offers elastic and secure virtual cloud servers to cater all your cloud hosting needs.Learn More
Alibaba Cloud Container Service for Kubernetes is a fully managed cloud container management service that supports native Kubernetes and integrates with other Alibaba Cloud products.Learn More
More Posts by Alibaba Clouder