码迷,mamicode.com
首页 > 系统相关 > 详细

shell脚本部署docker和docker-compose

时间:2019-06-24 18:26:41      阅读:150      评论:0      收藏:0      [点我收藏+]

标签:author   success   install   whoami   releases   http   script   can   uname   

shell脚本部署docker和docker-compose

#!/bin/bash

#Date: 2010-06-24
#Author: Bob
#Description: deploy docker&&docker-compose

if [[ "$(whoami)" != "root" ]]; then
    echo "Please run this script as root ." >&2
    exit 1
fi

echo -e "\033[31m Start installing docker&&docker-compose.Please continue to enter or ctrl+C to cancel \033[0m"

install_dependence(){
    yum -y install epel-release
}

install_docker(){
    yum -y install docker
    systemctl start docker.service
    docker -v
    echo "docker installed successfully."
}

install_docker_compose(){
    curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" > /usr/local/bin/docker-compose
    chmod +x /usr/local/bin/docker-compose
    docker-compose --version
    echo "docker-compose installed successfully."
}

main(){
    install_dependence
    install_docker
    install_docker_compose
}

main > /root/docker.log 2>&1

shell脚本部署docker和docker-compose

标签:author   success   install   whoami   releases   http   script   can   uname   

原文地址:https://blog.51cto.com/whnba/2412803

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!