Updated on 2024-02-26 GMT+08:00

Installing Docker

Introduction

Docker is an open-source application container engine that features portability, scalability, high security, and manageability. Developers can package applications and dependencies into portable containers, quickly release them to Linux servers, and use the OS-level virtualization to build, deploy, and manage applications more efficiently. This tutorial describes how you install Docker in Huawei Cloud EulerOS 2.0.

Preparations

Prepare an ECS.

Procedure

  1. Install Docker.

    1. Run the following command to install Docker:
      dnf install docker
    2. Run the following command to start Docker:
      systemctl start docker

  2. Verify that Docker is installed.

    1. Run the following command to run the hello-world image:
      docker run hello-world
    2. If information similar to the following is displayed, Docker is installed:

  3. Use Docker.

    1. Manage the Docker daemon.
      • Run the daemon.
      systemctl start docker
      • Stop the daemon.
      systemctl stop docker
      • Restart the daemon.
      systemctl restart docker
    2. Manage the images.
      • Edit the label.
      docker tag hello-world:latest hello-world:v1
      • View existing images.
      docker images
      • Forcibly delete an image.
      docker rmi -f hello-world:v1
    3. Manage containers.
      • Enter a container.
      docker run -it ImageId /bin/bash
      • Exit a container.
      exit
      • Access a container running in the backend.
      docker exec -it <Container ID> /bin/bash
      • Create an image from a container.
      docker commit <Container ID> [<Repository name>[:<Label>]]

      Example command:

      docker commit 135****9f757 hello-world:v1