Docker(一) 安装

Docker(一) 安装

安装前置(Ubuntu 18.10)

  • 替换源 https://www.bbsmax.com/A/obzbMrKBdE/
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
  • 更新apt索引
sudo apt-get update
  • 安装依赖包
apt-get install apt-transport-https ca-certificates curl software-properties-common -y
  • 设置仓库
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) \
  stable"
sudo apt-get update

Docker软件安装

查看支持的docker版本

apt-cache madison docker-ce 

安装docker

sudo apt-get install docker-ce -y 

注: 可以指定版本安装docker: apt-get install docker-ce= -y

版本号如:5:19.03.63-0ubuntu-cosmic

网卡区别

安装前:只有ens33和lo网卡 安装后:docker启动后,

多出来了docker0网卡,网卡地址如:172.17.0.1

基本目录

docker基本目录简介

/etc/docker/ docker的认证目录

/var/lib/docker/ docker的应用目录

Docker服务相关命令

ubuntu安装完毕后,默认就开启服务了

dokcer服务命令格式

  • systemctl start docker
  • systemctl stop docker
  • systemctl restart dockert
  • systemctl status docker
  • docker version

删除docker命令:

yum remove docker-ce 
rm -rf /var/lib/docker/ 
rm -rf /etc/docker

报错参考

下列软件包有未满足的依赖关系:
curl : 依赖: libcurl3 (= 7.35.0-1ubuntu2.5) 但是 7.47.0-1ubuntu2 正要被安装
E: 无法修正错误,因为您要求某些软件包保持现状,就是它们破坏了软件包间的依赖关系。

原因:libcurl3与系统原来的版本冲突
  
解决:直接卸载 sudo apt-get remove libcurl3

你可能感兴趣的:(Docker)