----------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
'debhttps://apt.dockerproject.org/repoubuntu-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
原文链接:https://www.f2er.com/centos/380966.html