Skip to content

Instantly share code, notes, and snippets.

@dvdme
Last active December 1, 2019 17:33
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 dvdme/4c07608a1d1c5a3529de627e12b287ec to your computer and use it in GitHub Desktop.
Save dvdme/4c07608a1d1c5a3529de627e12b287ec to your computer and use it in GitHub Desktop.
Install Docker on Ubuntu 18.04
#!/bin/bash
# Install with instructions from Docker
apt-get remove docker docker-engine docker.io containerd runc
apt-get update
apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
apt-key fingerprint 0EBFCD88
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
apt-get update
apt-get install docker-ce docker-ce-cli containerd.io
# Fix error
# docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.40/containers/create: dial unix /var/run/docker.sock: connect: permission denied.
# See 'docker run --help'.
groupadd docker
usermod -aG docker $USER
chmod 666 /var/run/docker.sock
# Verify all is good
docker run hello-world
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment