路漫漫其修远兮

Linux Ubuntu发行版一键安装Docker脚本

2019.05.07

bash脚本可以辅助一键安装docker服务 测试通过:ubuntu16.04 ubuntu18.04

Bash脚本

#!/bin/bash
# docker install for ubuntu
# s1@jiguang.in

# update system

sudo apt-get update -y

# install https procotol

sudo apt-get install apt-transport-https ca-certificates curl software-properties-common -y

# add docker gpg

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

# add repository

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

# install docker 

sudo apt-get install docker-ce -y

# testing

docker version

if [ $? -ne 0 ]
	then
		echo "[bash] docker success installed"
fi
发表评论