Ubantu下docker安装

1、获取Ubuntu 系统的内核版本uname -r,需要高于 3.10
2、获取最新版本的 Docker 安装包 wget -qO- https://get.docker.com/ | sh
3、当要以非root用户可以直接运行docker时,需要执行 sudo usermod -aG docker runoob 命令,然后重新登陆,否则会报错
4、启动docker服务sudo service docker start
5、参照如下代码修改镜像为阿里云镜像

sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https:/xxxxxx.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker

6、出现的问题:由于本机安装的Ubantu为14.04LTS版本,所以
配置时一直报sudo: systemctl: command not found这个错误。查阅资料得知
System Init Daemon

This has changed as part of the Ubuntu 15.04 devel cycle.

Ubuntu 15.04 (using Systemd by default):

Systemd runs with PID 1 as /sbin/init.

Upstart runs with PID 1 as /sbin/upstart. 

Prior versions (using Upstart by default):

Upstart runs with PID 1 as /sbin/init.

Systemd runs with PID 1 as /lib/systemd/systemd. 

7、 解决方法:
upstart

Docker is automatically configured to start on boot using upstart. To disable this behavior, use the following command:

$ echo manual | sudo tee /etc/init/docker.override

重启系统后,问题解决。
参照/etc/default/docker文件,有描述
参照资料:https://docs.docker.com/install/linux/linux-postinstall/#configure-docker-to-start-on-boot
https://wiki.ubuntu.com/SystemdForUpstartUsers?action=fullsearch&context=180&value=reload&titlesearch=标题
https://wiki.archlinux.org/index.php/systemd

你可能感兴趣的:(Docker)