2 回答

TA貢獻1963條經驗 獲得超6個贊
在centos7上我們可以通過yum來安裝docker1.確保你擁有管理員權限,需要可以使用sudo或者root的命令的權限。2.需要將你的yum的包升級到最新的狀態。sudoyumupdate3.為你的yum添加一個repo文件。在centos7下面您可以直接運行下面的代碼。cat>/etc/yum.repos.d/docker.repo<<-EOF[dockerrepo]name=DockerRepositorybaseurl=pleteStatus:Downloadednewerimageforhello-world:latestHellofromDocker.Thismessageshowsthatyourinstallationappearstobeworkingcorrectly.Togeneratethismessage,Dockertookthefollowingsteps:1.TheDockerclientcontactedtheDockerdaemon.2.TheDockerdaemonpulledthe"hello-world"imagefromtheDockerHub.3.TheDockerdaemoncreatedanewcontainerfromthatimagewhichrunstheexecutablethatproducestheoutputyouarecurrentlyreading.4.TheDockerdaemonstreamedthatoutputtotheDockerclient,whichsentittoyourterminal.Totrysomethingmoreambitious,youcanrunanUbuntucontainerwith:$dockerrun-itubuntubashShareimages,automateworkflows,andmorewithafreeDockerHubaccount:/userguide/如果看到這樣的命令就說明hello-world的鏡像安裝好了。這個時候我們再鍵入servicedockerstart就會提示Startingdocker(viasystemctl):[OK]說明我們的docker已經正常的在centos上運行了。

TA貢獻1827條經驗 獲得超8個贊
你好,方法如下:
1、Docker 軟件包已經包括在默認的 CentOS-Extras 軟件源里,需要配置好yum源,
2、安裝docker命令如下: yum -y install docker,
3、安裝完成后,使用下面的命令來啟動 docker 服務
4、下載官方的 CentOS 鏡像到本地 ,docker pull centos
5、搜索可用的docker鏡像,下載成功
6、在docker容器中安裝新的程序,命令docker run -ubuntu
apt-get install -y ping
7、在容器中用命令ping,發現測試可以使用
- 2 回答
- 0 關注
- 936 瀏覽
添加回答
舉報