Skip to content
WONGCW 網誌
  • 首頁
  • 論壇
  • 微博
  • 壁紙下載
  • 免費圖床
  • 視頻下載
  • 聊天室
  • SEO工具
  • 支援中心
  • 表格製作
  • More
    • 在線名片
    • 網頁搜索
    • 天氣預報
    • 二維碼生成器
    • WordPress 插件及主題下載
  • Search Icon

WONGCW 網誌

記錄生活經驗與點滴

Install Docker on CentOS7

Install Docker on CentOS7

2018-09-27 Comments 0 Comment

Docker is an open source containerization system. It is widely used for high density deployment of applications on the cloud. It uses the same kernel as the host operating system to virtualize an operating system. It has a big image repository that you can use to get a container up and running within a few minutes. The Docker image repository has a pre-configured Docker image for almost any type of application and operating system. Let’s say you want to run a PHP web server. You can find it on the Docker image repository and the base operating system might be Ubuntu, Debian or CentOS. There are different images for PHP for each different OS.  In this article, I will show you how to install Docker on CentOS 7. Let’s get started.

Installing Docker

I am using CentOS 7.4 as you can see from the output of the following command:

$ cat /etc/redhat-release

The version of kernel I am using is 3.10.0 as you can see from the output of the following command:

$ uname -r

You need yum-config-manager to enable CentOS 7 extras and Docker CE repository to your CentOS 7 machine. yum-config-manager is provided by yum-utils package.

You can install yum-utils package with the following command:

$ sudo yum install yum-utils -y

As you can see from the screenshot below, I already have yum-utils package installed on my machine. If you don’t have it, it will be installed.

Now you can enable the CentOS 7 extras repository with the following command:

$ sudo yum-config-manager –enable extras

Now run the following command to check whether extras repo is enabled:

$ sudo yum repolist

As you can see from the marked section in the screenshot below, the extras repo is enabled.

Docker depends on device-mapper-persistent-data and lvm2 package. You can install these packages with the following command:

$ sudo yum install device-mapper-persistent-data lvm2

Now press ‘y’ and then press <Enter> to continue.

device-mapper-persistent-data and lvm2 packages should be installed.

Now you have to add the Docker official repository to your CentOS 7 machine.

You can run the following command to add Docker repository to CentOS 7 using yum-config-manager:

$ sudo yum-config-manager –add-repo https://download.docker.com/linux/centos/docker-ce.repo

The Docker repository should be added.

Now you can install Docker.

To install Docker on your CentOS 7 machine, run the following command:

Press ‘y’ and then press <Enter> to continue.

Yum package manager should start downloading the Docker packages as shown in the screenshot below.

At a point, you may be asked to accept the GPG key of Docker. Press ‘y’ and then press <Enter> to continue.

The installation should continue as shown in the screenshot below.

Docker should be installed.

Now you can start Docker system service with the following command:

$ sudo systemctl start docker

You should also add Docker service to system startup. So it will start automatically on boot.

You can run the following command to add Docker service to system startup:

$ sudo systemctl enable docker

As you can see from the screenshot below, Docker system service is added to the startup.

Now add your user to the docker system group. That way you can access all the Docker commands without using sudo.

To add your user to docker group, run the following command:

$ sudo usermod -aG docker shovon

NOTE: Here shovon is the user of my CentOS 7 machine. Your user name should be different.

Now restart your CentOS 7 machine with the following command:

$ sudo reboot

Once your computer starts, you can check whether Docker is working with the following command:

$ docker version

As you can see from the screenshot below, the version of Docker installed on my CentOS 7 machine is 17.12. It is working correctly.

Basic Usage of Docker

You can run a default hello-world container of Docker to test whether it’s working or not.

You can run the following command to run the hello-world Docker container:

$ docker run hello-world

The hello-world container image will be searched on the local disk. For the first time, Docker will not find it. So it will be downloaded from the Docker repository. After the image is downloaded, Docker will make a container out of the image and run it as you can see from the screenshot below.

You can list the available Docker containers with the following command:

$ docker image ls

You can run the following command to find any information you might need about Docker on your system:

$ docker info

As you can see from the output of this command, the status of Docker is printed. Like how many containers you have, how many of them are running, how many of them are paused or stopped, how many Docker images you have downloaded, your configured storage driver, available disk space and many more. It’s a long list of information.

That’s how you install Docker on CentOS 7 and use it. Thanks for reading this article.

分享此文:

  • 分享到 Twitter(在新視窗中開啟)
  • 按一下以分享至 Facebook(在新視窗中開啟)
  • 分享到 WhatsApp(在新視窗中開啟)
  • 按一下以分享到 Telegram(在新視窗中開啟)
  • 分享到 Pinterest(在新視窗中開啟)
  • 分享到 Reddit(在新視窗中開啟)
  • 按一下即可以電子郵件傳送連結給朋友(在新視窗中開啟)
  • 點這裡列印(在新視窗中開啟)

相關


Linux資訊

Post navigation

PREVIOUS
宝塔Linux面板 – 9月19日更新 – 6.0.6 测试版
NEXT
阿卡信使用指南

發表迴響取消回覆

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料。

More results...

Generic filters
Exact matches only
Search in title
Search in content
Search in excerpt
Filter by 分類
網站公告
Featured
限時免費
Windows 軟件下載
系統軟件
辦公軟件
圖像處理
影音媒體
網絡軟件
應用軟件
Mac 軟件下載
安卓軟件下載
網絡資訊
Mac資訊
Linux資訊
VPS資訊
NASA資訊
WordPress資訊
WeChat資訊
PHP資訊
教學資源
開源程序
網頁工具
SEO工具
醫療健康
其他資訊
Content from
Content to
2018 年 9 月
一 二 三 四 五 六 日
 12
3456789
10111213141516
17181920212223
24252627282930
« 8 月   10 月 »

分類

  • 網站公告
  • 限時免費
  • Windows 軟件下載
  • 系統軟件
  • 辦公軟件
  • 圖像處理
  • 影音媒體
  • 網絡軟件
  • 應用軟件
  • Mac 軟件下載
  • 安卓軟件下載
  • 網絡資訊
  • Mac資訊
  • Linux資訊
  • VPS資訊
  • NASA資訊
  • WordPress資訊
  • WeChat資訊
  • PHP資訊
  • 教學資源
  • 開源程序
  • 網頁工具
  • SEO工具
  • 醫療健康
  • 其他資訊

彙整

近期文章

  • 氣象專家預計今秋將形成中等強度的厄爾尼諾事件 2023-09-28
  • 中國科學家從3500萬年前的糞便中發現地球長這樣 2023-09-28
  • 太陽能飛艇Airship One將在不使用燃料的情況下不間斷地環遊地球 2023-09-28
  • 英特爾在愛爾蘭開始大批量EUV生產Intel 4節點進入量產階段 2023-09-28
  • 讓人人都與AI嘮嗑:社群網路巨頭Meta正式推出聊天機器人 2023-09-28
  • 谷歌Pixel崛起蘋果iPhone在日本份額兩年來首次跌破50% 2023-09-28
  • 印度一智慧型手機爆炸引燃除臭劑附近所有窗戶被震碎三人受傷 2023-09-28
  • 福特叫停美國電池廠因頂不住特斯拉價格戰? 2023-09-28
  • Vivaldi 推出其iOS 版瀏覽器 2023-09-28
  • 讓我們看看生活在近5億年前的三葉蟲的菜單上有什麼 2023-09-28

熱門文章與頁面︰

  • 靠養貓養狗年入百萬:寵物博主是門怎樣的生意?
  • 打車叫到特斯拉不會開門很尷尬?官方介紹開關門方法
  • 盜版Windows 7還能免費升級Windows 10嗎?
  • Ghost Win10 專業完整版2018.09(32位+64位)
  • 系統優化工具Cacheman v10.60
  • YouTube By Click 2.2.86(含:註冊機序列號)
  • 4款家用血糖儀、尿酸儀對比評測
  • 世界上有多少個國家
  • Explorer Patcher:讓Windows 11恢復Windows 10的行為特徵
  • 電腦PC端翻牆工具vpn破解版

投遞稿件

歡迎各界人士投遞稿件到admin@wongcw.com

請提供以下資料:

1.你的名字

2.你的電郵

3.分類目錄

4.文章標題

5.文章摘要

6.文章內容

7.文章來源

 

聯繫我們

查詢,投稿,商務合作:
​admin@wongcw.com
​技術支援:
​support@wongcw.com
​客户服務:
​cs@wongcw.com

QQ群:833641851

快帆

MALUS

極度掃描

DMCA.com Protection Status

WONGCW 網誌

  • 免責聲明
  • 捐助我們
  • ThemeNcode PDF Viewer
  • ThemeNcode PDF Viewer SC
  • Events

服務器提供

本站使用之服務器由ikoula提供。

聯繫我們

查詢,投稿,商務合作:
​admin@wongcw.com
​技術支援:
​support@wongcw.com
​客户服務:
​cs@wongcw.com

QQ群:833641851

© 2023   All Rights Reserved.
 

載入迴響中...