摘要:默認(rèn)情況下屬于用戶和具有權(quán)限用戶的使用范疇。出于這個(gè)原因,守護(hù)進(jìn)程需要一直在用戶下面運(yùn)行。為了避免運(yùn)行命令的時(shí)候需要使用命令,創(chuàng)建一個(gè)叫的用戶組并將需要運(yùn)行的用戶添加進(jìn)去。驗(yàn)證運(yùn)行已不再需要命令開機(jī)運(yùn)行
官方原文鏈接 https://docs.docker.com/engine/installation/centos/
通過yum安裝需要root或者能sudo的權(quán)限
yum包更新到最新
$ sudo yum update
添加Docker yum源
$ 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包
$ sudo yum install docker-engine
啟動(dòng)Docker守護(hù)進(jìn)程
$ sudo service docker start
通過測(cè)試鏡像運(yùn)行一個(gè)容器來驗(yàn)證Docker是否安裝正確
$ 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包更新到最新
$ sudo yum update
運(yùn)行Docker安裝腳本
$ curl -sSL https://get.docker.com/ | sh
這個(gè)腳本會(huì)添加docker.repo倉庫并且安裝Docker
啟動(dòng)Docker守護(hù)進(jìn)程
$ sudo service docker start
通過測(cè)試鏡像運(yùn)行一個(gè)容器來驗(yàn)證Docker是否安裝正確
$ 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用戶組并添加用戶:
需要root或者能sudo的權(quán)限
創(chuàng)建docker用戶組并添加用戶
sudo usermod -aG docker your_username
退出并且登錄到y(tǒng)our_username,如果在your_username下也建議退出再重新登錄一次,這確保您的用戶正在運(yùn)行正確的權(quán)限。
驗(yàn)證運(yùn)行docker已不再需要sudo命令
$ docker run hello-world開機(jī)運(yùn)行docker
$ sudo chkconfig docker on
文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。
轉(zhuǎn)載請(qǐng)注明本文地址:http://m.hztianpu.com/yun/26518.html
摘要:的版本的版本分為社區(qū)版和企業(yè)版,想了解更多可以去官網(wǎng)查看其中分為和版本為季度發(fā)布版本,例如發(fā)布周期為一個(gè)季度為月度發(fā)布版本,例如發(fā)布周期為一個(gè)月安裝前先在官網(wǎng)查看支持的平臺(tái),不同系統(tǒng)下的安裝方法也都可以在官網(wǎng)找到,這里以在下安裝為例下 Docker的版本 Docker的版本分為Docker-ce社區(qū)版和Docker-ee企業(yè)版,想了解更多可以去官網(wǎng)查看其中Docker-ce分為stab...
摘要:官方教程一查看內(nèi)核是否符合要求版本內(nèi)核版本以上以上查看內(nèi)核版本二安裝卸載舊版本的舊版本名稱為或者。如果安裝過舊版本的需要先卸載安裝最新版本的最新版本的分兩個(gè)版本,和。我們安裝社區(qū)版。 官方教程:https://docs.docker.com/insta... 一、查看內(nèi)核是否符合要求 CentOS版本 內(nèi)核版本 CentOS 7 x64 3.10 以上 CentOS 6....
摘要:在系統(tǒng)啟動(dòng)時(shí)自動(dòng)啟動(dòng)如果您希望在啟動(dòng)時(shí)啟動(dòng),請(qǐng)參閱配置以在啟動(dòng)時(shí)啟動(dòng)。前言: Docker 是一個(gè)用于開發(fā)、傳送和運(yùn)行應(yīng)用程序的開放平臺(tái)。Docker 使您能夠?qū)?yīng)用程序與基礎(chǔ)設(shè)施分開,以便您可以快速交付軟件。使用 Docker,您可以像管理應(yīng)用程序一樣管理基礎(chǔ)設(shè)施。通過利用 Docker 的快速交付、測(cè)試和部署代碼的方法,您可以顯著減少編寫代碼和在生產(chǎn)中運(yùn)行代碼之間的延遲。為了讓開發(fā)、部...
摘要:背景已經(jīng)出來了很久,而我一直想混跡到大軍中進(jìn)行沖鋒陷陣,恰逢公司項(xiàng)目的需要,因此今天玩了一把的安裝事先準(zhǔn)備系統(tǒng)或者系統(tǒng)安裝步驟安裝基礎(chǔ)的工具添加倉庫因?yàn)樵诎⒗镌频臋C(jī)器上面,鏡像使用的阿里云的,找不到的鏡像,所以需要第一步 背景 docker已經(jīng)出來了很久,而我一直想混跡到docker大軍中進(jìn)行沖鋒陷陣,恰逢公司項(xiàng)目的需要,因此今天玩了一把docker的安裝 事先準(zhǔn)備 centos系統(tǒng)或...
閱讀 2986·2021-11-15 18:02
閱讀 3881·2021-10-14 09:43
閱讀 3869·2021-09-08 10:41
閱讀 2582·2019-08-30 15:53
閱讀 1864·2019-08-30 14:14
閱讀 2018·2019-08-29 16:12
閱讀 3207·2019-08-29 14:03
閱讀 1340·2019-08-29 13:46