首页 > 代码库 > 在CentOS 7 和ubuntu 16.04 下安装Docker
在CentOS 7 和ubuntu 16.04 下安装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
本文出自 “网事” 博客,请务必保留此出处http://gxjluck.blog.51cto.com/1211751/1844337
在CentOS 7 和ubuntu 16.04 下安装Docker
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。