一区二区三区在线-一区二区三区亚洲视频-一区二区三区亚洲-一区二区三区午夜-一区二区三区四区在线视频-一区二区三区四区在线免费观看

服務(wù)器之家:專注于服務(wù)器技術(shù)及軟件下載分享
分類導(dǎo)航

Linux|Centos|Ubuntu|系統(tǒng)進(jìn)程|Fedora|注冊(cè)表|Bios|Solaris|Windows7|Windows10|Windows11|windows server|

服務(wù)器之家 - 服務(wù)器系統(tǒng) - Centos - Centos下安裝docker教程

Centos下安裝docker教程

2020-09-22 16:38Centos教程網(wǎng) Centos

本文給大家介紹的是在centos下安裝docker的詳細(xì)教程,分為yum安裝和腳本安裝2種方式,有需要的小伙伴可以參考下。

通過yum安裝

需要root或者能sudo的權(quán)限

yum包更新到最新

 
?
1
 
$ sudo yum update

添加Docker yum源

 
?
1
 
2
3
4
5
6
7
8
$ sudo tee /etc/yum.repos.d/docker.repo <<-'EOF'
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
EOF

安裝Docker包

 
?
1
 
$ sudo yum install docker-engine

啟動(dòng)Docker守護(hù)進(jìn)程

 
?
1
 
$ sudo service docker start

通過測試鏡像運(yùn)行一個(gè)容器來驗(yàn)證Docker是否安裝正確

 
?
1
 
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
$ sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
  latest: Pulling from hello-world
  a8219747be10: Pull complete
  91c95931e552: Already exists
  hello-world:latest: The image you are pulling has been verified. Important: image verification is a tech preview feature and should not be relied on to provide security.
  Digest: sha256:aa03e5d0d5553b4c3473e89c8619cf79df368babd1.7.1cf5daeb82aab55838d
  Status: Downloaded newer image for hello-world:latest
  Hello from Docker.
  This message shows that your installation appears to be working correctly.
 
 
  To generate this message, Docker took the following steps:
   1. The Docker client contacted the Docker daemon.
   2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
      (Assuming it was not already locally available.)
   3. The Docker daemon created a new container from that image which runs the
      executable that produces the output you are currently reading.
   4. The Docker daemon streamed that output to the Docker client, which sent it
      to your terminal.
 
 
  To try something more ambitious, you can run an Ubuntu container with:
   $ docker run -it ubuntu bash
 
 
  For more examples and ideas, visit:
   http://docs.docker.com/userguide/

通過腳本安裝

需要root或者能sudo的權(quán)限

yum包更新到最新

 
?
1
 
$ sudo yum update

運(yùn)行Docker安裝腳本

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

這個(gè)腳本會(huì)添加docker.repo倉庫并且安裝Docker

啟動(dòng)Docker守護(hù)進(jìn)程

 
?
1
 
$ sudo service docker start

通過測試鏡像運(yùn)行一個(gè)容器來驗(yàn)證Docker是否安裝正確

 
?
1
 
$ sudo docker run hello-world

創(chuàng)建一個(gè)Docker用戶組

docker守護(hù)進(jìn)程綁定在Unix socket 而不是 TCP 端口。默認(rèn)情況下Unix socket屬于root用戶和具有sudo權(quán)限用戶的使用范疇。出于這個(gè)原因,docker守護(hù)進(jìn)程需要一直在root用戶下面運(yùn)行。

To avoid having to use sudo when you use the docker command, create a Unix group called docker and add users to it. When the docker daemon starts, it makes the ownership of the Unix socket read/writable by the docker group.

為了避免運(yùn)行docker命令的時(shí)候需要使用sudo命令,創(chuàng)建一個(gè)叫docker的Unix用戶組并將需要運(yùn)行docker的用戶添加進(jìn)去。當(dāng)開始運(yùn)行docker守護(hù)進(jìn)程,會(huì)令docker用戶組的成員擁有Unix socket的讀寫權(quán)限。

創(chuàng)建docker用戶組并添加用戶:

1.需要root或者能sudo的權(quán)限
2.創(chuàng)建docker用戶組并添加用戶

 
?
1
 
sudo usermod -aG docker your_username

3.退出并且登錄到y(tǒng)our_username,如果在your_username下也建議退出再重新登錄一次,這確保您的用戶正在運(yùn)行正確的權(quán)限。
4.驗(yàn)證運(yùn)行docker已不再需要sudo命令

 
?
1
 
$ docker run hello-world

開機(jī)運(yùn)行docker

 
?
1
 
$ sudo chkconfig docker on

 

延伸 · 閱讀

精彩推薦
  • Centoscentos不小心刪除/root目錄該如何解決?

    centos不小心刪除/root目錄該如何解決?

    一些朋友最近在問小編centos不小心刪除/root目錄該如何解決?今天小編就為大家分享centos不小心刪除/root目錄解決辦法;希望對(duì)大家會(huì)有幫助,有需要的朋友...

    腳本之家8022019-05-29
  • Centoscentos 安裝與操作方法

    centos 安裝與操作方法

    這篇文章主要介紹了centos 安裝與操作方法,需要的朋友可以參考下...

    centos之家5272019-07-11
  • CentosCentos 7開啟網(wǎng)卡自動(dòng)獲取IP的詳細(xì)方法

    Centos 7開啟網(wǎng)卡自動(dòng)獲取IP的詳細(xì)方法

    本篇文章主要介紹了Centos 7開啟網(wǎng)卡自動(dòng)獲取IP的詳細(xì)方法,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧...

    凌鋒8972021-12-29
  • CentosCentOS6.5下Redis安裝與配置詳細(xì)步驟

    CentOS6.5下Redis安裝與配置詳細(xì)步驟

    本篇文章主要介紹了CentOS6.5下Redis安裝與配置詳細(xì)步驟,詳細(xì)介紹redis單機(jī)單實(shí)例安裝與配置,服務(wù)及開機(jī)自啟動(dòng)。有興趣的可以了解一下。...

    飛流11452021-12-24
  • CentosCentos7運(yùn)用/dev/shm進(jìn)行網(wǎng)站優(yōu)化

    Centos7運(yùn)用/dev/shm進(jìn)行網(wǎng)站優(yōu)化

    這篇文章主要介紹了LINUX中Centos7運(yùn)用/dev/shm進(jìn)行網(wǎng)站優(yōu)化相關(guān)知識(shí)點(diǎn),對(duì)此有興趣的朋友參考學(xué)習(xí)下。...

    彬菌9912022-03-02
  • CentosCentOS 6.6實(shí)現(xiàn)永久修改DNS地址的方法

    CentOS 6.6實(shí)現(xiàn)永久修改DNS地址的方法

    這篇文章主要介紹了CentOS 6.6實(shí)現(xiàn)永久修改DNS地址的方法,涉及針對(duì)CentOS配置文件的相關(guān)設(shè)置技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下 ...

    Linux社區(qū)4472020-08-21
  • CentosCentOS7設(shè)置日期和時(shí)間方法以及基本概念介紹

    CentOS7設(shè)置日期和時(shí)間方法以及基本概念介紹

    這篇文章主要介紹了CentOS7設(shè)置日期和時(shí)間方法以及基本概念介紹,本文講解使用CentOS7中的新命令timedatectl設(shè)置日期時(shí)間方法,需要的朋友可以參考下 ...

    CentOS之家6522019-09-19
  • CentosCentOS下Uptime命令詳解

    CentOS下Uptime命令詳解

    在Linux下,我們可以使用uptime命令,而且此命令不必使用root權(quán)限。uptime命令在系統(tǒng)中已經(jīng)默認(rèn)安裝了。今天小編為大家?guī)淼氖荂entOS下Uptime命令詳解;希望...

    CentOS之家11482019-06-19
主站蜘蛛池模板: 精品一区二区国语对白 | 扒开双腿羞辱调教play视频 | 国产免费不卡视频 | 国产在线看片网站 | freesex 18 19处xx | 99热免费在线 | 久久足恋网 | 日本丰满大乳乳奶 | 国产大乳美女挤奶视频 | 国产精品www视频免费看 | 国产99精品免费视频看6 | 美女被吸乳得到大胸 | 欧美视频一级 | 国产亚洲精品一区久久 | kayden kross喷水 | 久青草国产在视频在线观看 | 摸进老太婆的裤裆小说 | 日韩亚洲人成网站在线播放 | 亚偷熟乱区视频在线观看 | 色天天综合色天天碰 | 暖暖 免费 高清 日本 中文 | 1024亚洲精品国产 | 91精品啪在线观看国产线免费 | 美女张开腿让我了一夜 | 久久久久九九 | 欧美一区二区不卡视频 | 亚洲国产成人99精品激情在线 | h片免费网站 | 午夜第一页 | 国产福利资源 | 四虎成人免费大片在线 | 成人久久18免费网站 | 欧美一级特黄aaa大片 | 亚洲国产视频网站 | 国产小视频网站 | 国产一区二区视频在线观看 | 日本全黄三级在线观看 | 成人在线播放 | 欧产日产国产精品专区 | 含羞草传媒一天免费看下 | 成人午夜毛片 |