溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

在CentOS、Fedora系統(tǒng)中如何使用Docker

發(fā)布時間:2021-07-19 14:27:00 來源:億速云 閱讀:179 作者:小新 欄目:系統(tǒng)運維

小編給大家分享一下在CentOS、Fedora系統(tǒng)中如何使用Docker,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!

一、從docker官方y(tǒng)um源進(jìn)行安裝

1、添加docker官方源

cat >/etc/yum.repos.d/docker.repo <<-EOF
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/7
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
EOF

2、安裝和啟動

#安裝
sudo yum install docker-engine
#啟動
sudo systemctl enable docker.service
#開機啟動
systemctl enable docker.service
#驗證安裝
sudo docker run hello-world

二、用腳本的方式安裝

curl -sSL https://get.docker.com/ | sh

三、非特權(quán)用戶運行 docker 命令

在 CentOS 或 Fedora 上安裝完成 Docker 后,為了能以非 root 用戶運行 docker,你需要把你自己添加進(jìn) docker 用戶組,使用如下命令:

sudo usermod -a -G docker $USER

登出,然后再登入,以使組改變生效。
這個時候,你應(yīng)該可以以一個非特權(quán)用戶運行 docker 命令了。

四、使用國內(nèi)源

1、安裝dao

curl -sSL https://get.daocloud.io/daomonit/install.sh | sh -s 6d3f36d42ae3f3d4237943c65c8f3e5446e49a71

2、使用dao命令

dao pull ubuntu

看起來像這樣:

?  ~  dao pull ubuntu
Dao from DaoCloud
Initializing, Please wait a minute
Using default tag: latest
Pulling repository daocloud.io/daocloud/daocloud-toolset
aa5dc2eecd4a: Download complete
Status: Image is up to date for daocloud.io/daocloud/daocloud-toolset:latest
daocloud.io/daocloud/daocloud-toolset: this image was pulled from a legacy registry.  Important: This registry version will not be supported in future versions of docker.
Inital Success


# ----------------------------------------------------------------------------
# DaoCloud ToolBox for Docker
#
# DaoCloud, Inc. (c) 2015
#
# Fastest way to pull image from Docker Registry
# ----------------------------------------------------------------------------

Pulling repository ubuntu
Pulling ubuntu image metadata
Pulling ubuntu:latest tag metadata
0105f98ced6d: Load layer complete
66395c31eb82: Load layer complete
002fa881df8a: Load layer complete
a005e6b7dd01: Load layer complete
Loading image to docker ...

** Pull ubuntu success. **
You can find it with 'docker images ubuntu'

以上是“在CentOS、Fedora系統(tǒng)中如何使用Docker”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對大家有所幫助,如果還想學(xué)習(xí)更多知識,歡迎關(guān)注億速云行業(yè)資訊頻道!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI