Docker学习笔记之ubuntu安装docker

时间:2022-11-07 06:32:12

1. 确认linux内核版本为3.8以上

$ uname -a

3.16.0-30-generic #40~14.04.1-Ubuntu

2. 检查Device Mapper

$ sudo grep device-mapper /proc/devices

3.安装docker

$ sudo apt-get -y install apt-transport-https

$  sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9

$ sudo bash -c "echo deb https://get.docker.io/ubuntu docker main >/etc/apt/sources.list.d/docker.list"

$ apt-get update

$ apt-get -y install lxc-docker

查看docker版本

$ docker -v

Docker version 1.7.1, build 786b29d

查看docker信息

$ sudo docker info

Containers: 0
Images: 0
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 0
 Dirperm1 Supported: true
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 3.16.0-30-generic
Operating System: Ubuntu 14.04.2 LTS
CPUs: 4
Total Memory: 7.68 GiB
Name: shentao-ThinkPad-T440s
ID: LZSH:RFR3:Z752:4VGG:5VAT:3TNJ:G2WR:DOW6:BUXZ:ZGVZ:HCT6:RWJJ
WARNING: No swap limit support

4. 设置权限

由于守护进程/var/run/docker.sock的权限为docker组, 而不是主用户组, 故需要用sudo运行.如不想每次都用root用户, 可将本机用户加入到docker群组:

$ sudo gpasswd –a ${USER} docker 

此时若仍出现权限问题, 请重启docker守护进程或重启计算机.

检查docker守护进程是否正在运行:

$ sudo status docker

docker start/running, process 7170

停止/开始docker守护进程:

$ sudo stop docker 

$ sudo start docker

重启守护进程:

$ sudo restart docker

docker start/running, process 8015

5. 升级docker

$ sudo apt-get -u -y upgrade lxc-docker

6. docker图形用户界面

Shipyard: http://github.com/ehazlett/shipyard

DockerUI: http://github.com/crosbymichael/dockerui

maDocker: http://github.com/izifortune/maDocker