我的是centos7,也會(huì)6的方法: $sudo yum install docker 直接yum安裝contos7 啟動(dòng)Docker,,并注冊(cè)開機(jī)服務(wù) [root@iZ258c9w799Z ~]# sudo service docker start Redirecting to /bin/systemctl start docker.service [root@iZ258c9w799Z ~]# sudo chkconfig docker on Note: Forwarding request to 'systemctl enable docker.service'. Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service. [root@iZ258c9w799Z ~]# ps -ef|grep docker 下載images鏡像,,現(xiàn)在下載基礎(chǔ)的contos鏡像: [root@iZ258c9w799Z ~]# sudo docker pull centos:7 Trying to pull repository docker.io/library/centos ... 7: Pulling from library/centos 1544084fad81: Pull complete df0fc3863fbc: Pull complete a3d54b467fad: Pull complete a65193109361: Pull complete Digest: sha256:a9237ff42b09cc6f610bab60a36df913ef326178a92f3b61631331867178f982 Status: Downloaded newer image for docker.io/centos:7 查看是否安裝成功: [root@iZ258c9w799Z ~]# sudo docker images centos REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE docker.io/centos 7 a65193109361 2 weeks ago 196.7 MB 可以去docker下載你需要的鏡像:https://hub./ 常用docker命令: 1,、docker -h 幫助 2、獲取鏡像 sudo docker pull NAME[:TAG] sudo docker pull centos:latest 3,、啟動(dòng)Container盒子 sudo docker run [OPTIONS] IMAGE [COMMAND] [ARG...] sudp docker run -t -i contos /bin/bash 4、查看鏡像列表,,列出本地的所有images sudo docker images [OPTIONS] [NAME] sudo docker images centos 5,、查看容器列表,可看到我們創(chuàng)建過的所有container sudo docker ps [OPTIONS] sudo docker ps -a 6,、刪除鏡像,,從本地刪除一個(gè)已經(jīng)下載的鏡像 sudo docker rmi IMAGE [IMAGE...] sudo docker rmi centos:latest 7、移除一個(gè)或多個(gè)容器實(shí)例 sudo docker rm [OPTIONS] CONTAINER [CONTAINER...] 移除所有微運(yùn)行的容器 sudo docker rm sudo docker ps -aq 8,、停止一個(gè)正在運(yùn)行的容器 sudo docker kill [OPTIONS] CONTAINER [CONTAINNER...] sudo docker kill 026e 9、重啟一個(gè)正在運(yùn)行的容器 sudo docker restart [OPTIONS] contains[CONTAINER] sudo docker restart 026e 10,、停止一個(gè)已經(jīng)停止的容器 sudo docker start [OPTIONS] CONTAINER [CONTAINER..] sudo docker start 026e
|
|