西部数码主机 | 阿里云主机| 虚拟主机 | 服务器 | 返回乐道官网
当前位置: 主页 > 开发教程 > linux教程 >

在CentOS 7 和ubuntu 16.04 下安装Docker

时间:2016-10-20 14:08来源:未知 作者:好模板编辑 点击:
--------CentOS 7--------------------- sudo adduser --system --no-create-home --user-group -s /sbin/nologin docker sudo yum -y update sudo cat /etc/yum.repos.d/docker.repo - EOF [dockerrepo] name=Docker Repository baseurl=https: //yum.docker
--------CentOS 7---------------------
 
 
 
sudo adduser --system --no-create-home --user-group -s /sbin/nologin docker
 
sudo yum -y update
sudo cat >> /etc/yum.repos.d/docker.repo <<- 'EOF'
[dockerrepo]
name=Docker Repository
baseurl=https: //yum.dockerproject.org/repo/main/centos/$releasever/
enabled= 1
gpgcheck= 1
gpgkey=https: //yum.dockerproject.org/gpg
EOF
 
sudo yum install -y docker-engine
sudo yum -y install python-setuptools
sudo easy_install pip
sudo pip install docker-compose
 
#  do  this  step  if  '/data'  is the big storage than  '/'
sudo systemctl stop docker.service
sudo mkdir -p /data/docker-var/docker
sudo rm -rf /var/lib/docker
sudo ln -s /data/docker-var/docker /var/lib/docker
 
sudo sed -i  's:ExecStart=/usr/bin/docker daemon -H fd\://:ExecStart=/usr/bin/docker daemon -H fd\:// --log-opt max-size=100m --log-opt max-file=50:g'   /lib/systemd/system/docker.service
sudo systemctl daemon-reload
sudo systemctl restart docker.service
 
 
-------------Ubuntu 16.04---------------------
 
https: //docs.docker.com/engine/installation/linux/ubuntulinux/
 
#sudo apt-get update
#sudo apt-get install apt-transport-https ca-certificates
sudo apt-key adv --keyserver hkp: //p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
echo  'deb https://apt.dockerproject.org/repo ubuntu-xenial main' >/etc/apt/sources.list.d/docker.list
sudo apt-get update
#sudo apt-get purge lxc-docker
apt-cache policy docker-engine
#sudo apt-get install linux-image-extra-$(uname -r)
 
sudo apt-get update
sudo apt-get install docker-engine
sudo service docker start
 
sudo groupadd docker
sudo usermod -aG docker ubuntu
 
sudo apt-get install python-pip
sudo pip install docker-compose
sudo ufw status
sudo nano /etc/ default /ufw
#  "DEFAULT_FORWARD_POLICY=" ACCEPT ""
sudo ufw allow  2375 /tcp
sudo ufw reload
(责任编辑:好模板)
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
栏目列表
热点内容