How To Install and Use Docker on CentOS 7

Docker is a containerization technology that allows you to quickly build, test and deploy applications as portable, self-sufficient containers that can virtually run everywhere.

In this tutorial we’ll go through how to install Docker CE on CentOS 7 and explore the basic Docker concepts and commands.

Prerequisites

Before proceeding with this tutorial, make sure that the following prerequisites are met:

  • CentOS 7 server
  • You have non-root user with sudo privileges. You check this guide about how create a new sudo user.

Install Docker on CentOS

Although the Docker package is available in the official CentOS 7 repository it may not always be the latest version. The recommended approach is to install Docker from the Docker’s repositories.

To install Docker on your CentOS 7 server follow the steps below:

  1. Start by updating your system packages and install the required dependencies:

    sudo yum updatesudo yum install yum-utils device-mapper-persistent-data lvm2
    Copy
  2. Next, run the following command which will add the Docker stable repository to your system:

    sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
    Copy
  3. Now that the Docker repository is enabled, install the latest version of Docker CE (Community Edition) using yum by typing:

    sudo yum install docker-ce
    Copy
  4. Once the Docker package is installed, start the Docker daemon and enable it to automatically start at boot time:

    sudo systemctl start dockersudo systemctl enable docker
    Copy
  5. To verify that the Docker service is running type:

    sudo systemctl status docker
    Copy

    The output should look something like this:

    ● docker.service - Docker Application Container Engine
       Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
       Active: active (running) since Wed 2018-10-31 08:51:20 UTC; 7s ago
         Docs: https://docs.docker.com
     Main PID: 2492 (dockerd)
       CGroup: /system.slice/docker.service
               ├─2492 /usr/bin/dockerd
               └─2498 docker-containerd --config /var/run/docker/containerd/containerd.toml
    Copy
  6. At the time of writing, the current stable version of Docker is 18.06.1, to print the Docker version type:

    docker -v
    Copy
    Docker version 18.06.1-ce, build e68fc7a
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值