1. Update your package management system.
$ sudo apt-get update
2. Install Dependencies
$ sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
3. Add the official Docker GPG key:
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
4. Set up the stable repository
$ sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
5. Update your package management system again.
$ sudo apt-get update
6. Install Docker
$ sudo apt-get install docker-ce docker-ce-cli containerd.io
7. Verify that Docker Engine is installed correctly by running the hello-world image.
$ sudo docker run hello-world
8. Running sudo everytime is not practical. If you were to run the docker command without the sudo, you will get a permissions error.
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/json?all=1: dial unix /var/run/docker.sock: connect: permission denied
To fix this, execture the following commands:
$ sudo groupadd docker
$ sudo usermod -aG docker ${USER}
$ su - ${USER}
9. Verify is working
$ docker run hello-world
For more speific and detail instructions, visit https://docs.docker.com/engine/install/ubuntu/
For Laravel
For laravel, you may have to install docker-compose if you get this error;
./vendor/bin/sail: line 40: docker-compose: command not found
./vendor/bin/sail: line 42: docker-compose: command not found
./vendor/bin/sail: line 200: docker-compose: command not found
Command 'docker-compose' not found, but can be installed with:
sudo snap install docker # version 19.03.11, or
sudo apt install docker-compose # version 1.25.0-1
See 'snap info docker' for additional versions.
#!/bin/bash
clear
echo "Installing Docker Engine.."
#source: https://www.webune.com/forums/arpxmz.html
sudo apt-get update
sudo 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 -
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 docker-ce docker-ce-cli containerd.io
sudo groupadd docker
sudo usermod -aG docker ${USER}
su - ${USER}
sudo snap install docker
sudo apt install docker-compose
sudo docker run hello-world