5.Ubuntu下一键式安装docker相关组件

为了更好的学习和使用docker,下面将Docker ce,Docker Machine,Docker Compose的安装与配置整合成了一个shell文件。


shell文件内容如下:

#环境依赖
sudo apt-get install -y \
    apt-transport-https \
    ca-certificates \
    curl \
    wget \
    software-properties-common 


#添加docker官方GPG秘钥

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -


#安装稳定版仓库

sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

#再次更新源

sudo apt-get update


#安装docker-ce

sudo apt-get install -y  docker-ce

#sudo apt-get install -y curl docker.io

#sudo apt-get install -y virtualbox-qt

#sudo curl -L https://github.com/docker/compose/releases/download/1.16.1/docker-compose-`uname -s`-`uname -m` -o >> /usr/local/bin/docker-compose


#安装docker-compose
sudo curl -L https://coding.net/u/jamesz2011/p/ubuntu_lib/git/raw/master/docker/docker-compose-Linux-x86_64 > /usr/local/bin/docker-compose

sudo chmod +x /usr/local/bin/docker-compose
sudo docker-compose --version




#安装docker-machine
sudo curl -L https://coding.net/u/jamesz2011/p/ubuntu_lib/git/raw/master/docker/docker-machine>/tmp/docker-machine &&
    chmod +x /tmp/docker-machine &&
    sudo cp /tmp/docker-machine /usr/local/bin/docker-machine
    
    
#设置docker免sudo  
sudo groupadd docker
sudo gpasswd -a ${USER} docker
sudo service docker restart
sudo newgrp - docker

#安装virtualbox,方便docker-machine create -d virtual xxx(某某)使用。
sudo apt-get update 
sudo apt-get install -y virtualbox

echo "cant install docker_swarm!!!"
echo "ok,all process is over!!!"


[install_docker_v1.sh 下载地址:] https://coding.net/u/jamesz2011/p/ubuntu_lib/git/raw/master/docker/install_docker_v1.sh


[使用方法:]
su root
chmod a+x install_docker_v1.sh
./install_docker_v1.sh

你可能感兴趣的:(5.Ubuntu下一键式安装docker相关组件)