Installing docker container in ubuntu with shell script

The following shell script is automate the installation for Docker in your server, you may use this code to put in your EC2 user data when you launch the instance, than once the server up and running, the docker already ready in your server.

#!/bin/sh
# https://docs.docker.com/engine/installation/linux/ubuntu/#install-using-the-repository
sudo apt-get update && sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88 | grep [email protected] || exit 1
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install -y docker-ce
sudo docker run --rm hello-world
sudo usermod -aG docker $USER
newgrp docker

To automate the installation for the docker in your server, just use following command.

$ wget https://gist.githubusercontent.com/david2331/d579b295c3136c43d2fe7b09dcb85da0/raw/d91f5b382bfab35789ddeec36f7f4c4cfeadff69/installing-docker-ubuntu.sh

$ sudo chmod +x installing-docker-ubuntu.sh
$ sudo ./installing-docker-ubuntu.sh

Click here for more detail

Leave a Reply

google.com, pub-3772983857049267, DIRECT, f08c47fec0942fa0
%d bloggers like this: