Skip to content

Instantly share code, notes, and snippets.

@szepnapot
Last active December 2, 2018 11:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save szepnapot/385f026c076f791d85722dcf549e66d4 to your computer and use it in GitHub Desktop.
Save szepnapot/385f026c076f791d85722dcf549e66d4 to your computer and use it in GitHub Desktop.
How To Install and Use Docker on Ubuntu 18.04
#!/bin/bash
# check for root first
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
# update local packages
apt update
# let apt use packages over HTTPS
apt install apt-transport-https ca-certificates curl software-properties-common -yq
# add the GPG key for the official Docker repository
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
# add the Docker repository to APT sources
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable" -y
# pick up changes
apt update -yq
# double check that we not use ubuntu's defult repossitory
apt-cache policy docker-ce
# install Docker
apt install docker-ce -yq
# check service
systemctl status docker
usermod -aG docker ${USER}
id -nG
docker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment