安裝docker

hgs19921112發表於2020-03-26
1. close Selinux
 2.check 
 3. Uninstall old versions
    yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine
4. SET UP THE REPOSITORY
    yum install -y yum-utils \
      device-mapper-persistent-data \
      lvm2
5. install docker
   yum install docker-io
6. run the test image
   docker run hello-world
7. list the images have stored
   docker image ls
8 list the run container
   docker ps --all
9.build a docker image  with the example:  git clone 
  9.1 build the image with : docker build --tag bulletinboard:1.0 .
  9.2 run the container : docker run --publish 8000:8080 --detach --name bb bulletinboard:1.0
      --publish 
  8000 container port 8080 app port 
  --detach run background 
  --name the name 
      bulletinboard:1.0 :the tag
  
  
修改為中國的映象地址:
因為眾所周知的原因,在docker官方倉庫拉取映象會特別慢,所以我們需要修改docker映象地址
在宿主機器編輯檔案:vi /etc/docker/daemon.json
請在該配置檔案中加入(沒有該檔案的話,請先建一個):
{"registry-mirrors": ["]}
最後,需要重啟docker服務 systemctl restart docker


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31506529/viewspace-2682802/,如需轉載,請註明出處,否則將追究法律責任。

相關文章