首頁  >  文章  >  系統教程  >  CentOS和Fedora系統使用Docker的指南

CentOS和Fedora系統使用Docker的指南

王林
王林轉載
2024-01-15 09:27:091126瀏覽

一、從docker官方yum來源進行安裝

#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

三、非特權使用者執行 docker 指令

在 CentOS 或 Fedora 上安裝完成 Docker 後,為了能以非 root 使用者執行 docker,你需要把自己加入 docker 使用者群組,使用以下命令:

sudo usermod -a -G docker $USER

登出,然後再登入,以使群組變更生效。
這個時候,你應該可以以一個非特權使用者執行 docker 指令了。

四、使用國內源

1、安裝dao

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

2、使用dao指令

dao pull ubuntu

看起來像這樣:

&#10140;~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系統使用Docker的指南的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文轉載於:jb51.net。如有侵權,請聯絡admin@php.cn刪除