ubuntu 18.04安装码头工人

  

修改贴切源

  
 #, sudo  vim /etc/apt/sources.list
  deb  http://mirrors.aliyun.com/ubuntu/  bionic  main  restricted  universe 多元宇宙
  deb  http://mirrors.aliyun.com/ubuntu/  bionic-security  main  restricted  universe 多元宇宙
  deb  http://mirrors.aliyun.com/ubuntu/  bionic-updates  main  restricted  universe 多元宇宙
  deb  http://mirrors.aliyun.com/ubuntu/  bionic-proposed  main  restricted  universe 多元宇宙
  deb  http://mirrors.aliyun.com/ubuntu/  bionic-backports  main  restricted  universe 多元宇宙
  deb-src  http://mirrors.aliyun.com/ubuntu/  bionic  main  restricted  universe 多元宇宙
  deb-src  http://mirrors.aliyun.com/ubuntu/  bionic-security  main  restricted  universe 多元宇宙
  deb-src  http://mirrors.aliyun.com/ubuntu/  bionic-updates  main  restricted  universe 多元宇宙
  deb-src  http://mirrors.aliyun.com/ubuntu/  bionic-proposed  main  restricted  universe 多元宇宙
  deb-src  http://mirrors.aliyun.com/ubuntu/  bionic-backports  main  restricted  universe 多元宇宙
  #,sudo  apt-get 更新
  #,sudo  apt-get 升级
     

安装依赖库   

  
 #, sudo  apt-get  install , -y  apt-transport-https , ca-certificates  curl , software-properties-common 
     

添加码头工人官方GPG密钥

  
 #, curl  -fsSL  https://download.docker.com/linux/ubuntu/gpg  |, sudo  apt-key  add  - 
     

设置码头工人稳定版仓库

  
 #, sudo  add-apt-repository “deb [拱=amd64], https://download.docker.com/linux/ubuntu ,美元(lsb_release  c),, stable" 
     

更倾向新源索引

  
 #, sudo  apt-get 更新
     

安装最新版码头工人CE(社区版)

  
 #, sudo  apt-get  install  -y  docker-ce 
     

检查码头工人CE是否安装正确,出现,从码头工人你好!,则表示安装成功

  
 #, sudo  docker  run  hello world
  Unable 用find  image  & # 39; hello world:最新# 39;在本地
  最新:Pulling 得到图书馆/hello world
  1 b930d010525: Pull  complete 
  文摘:sha256:4df8ca8a7e309c256d60d7971ea14c27672fc0d10c5f303856d7bc48f8cc17ff
  状态:,Downloaded  newer  image  for  hello world:最新
  Hello 得到码头工人!
  却,能够message  shows  that  your  installation  appears 用be  working 正确。
  用generate 却;能够消息,Docker  took 从而following 步骤:
  ,1只,Docker  client  contacted 从而Docker 守护进程。
  ,2只,Docker  daemon  pulled ,“hello-world", image 得到,Docker 中心。
  ,,,(amd64)
  ,3只,Docker  daemon  created  a  new  container 得到that  image  which  runs 
  ,,,executable  that  produces 从而output 你断开连接;currently 阅读。
  ,4只,Docker  daemon  streamed  that  output 用,Docker 客户端,which  sent 它
  ,,,用your 终端。
  用try  something  more 雄心勃勃,,你还要run  an  Ubuntu  container :
  ,美元docker  run  -it  ubuntu  bash
  Share 图像,automate 工作流,以及more  with  a  free  Docker  ID:
  ,https://hub.docker.com/For  more  examples 以及想法,,访问:
  ,https://docs.docker.com/get-started/
     

安装docker-compose   <>之前,美元sudo  curl  -L  https://github.com/docker/compose/releases/download/1.25.0-rc4/docker-compose-“uname  - s”——“uname  - m”, -o /usr/地方/bin/docker-compose   美元,sudo  chmod  + x /usr/地方/bin/docker-compose   美元,docker-compose 版本      

设置权限,不用每次都输入sudo

  <>之前,美元sudo  usermod  -a  -G  docker 码头工人      

码头工人常用命令   

  
 #, #,启动码头工人
  #,sudo  service  docker 开始
  #,#,停止码头工人
  #,sudo  service  docker 停止
  #,#,重启码头工人
  #,sudo  service  docker 启动

ubuntu 18.04安装码头工人