DEV Community

Cover image for Docker Environment Setup
Deepak Porwal
Deepak Porwal

Posted on • Edited on

Docker Environment Setup

* Create DigitalOcean Account

You can use my referral you will get $100 free usage for 3 months.
By clicking below.

DigitalOcean Referral Badge

* Create a Droplet

Create Droplet

* Use the following Configuration for Droplet.

You have to open image and zoom
Droplet Configuration

In case of ssh key generation

Click on New SSH Key as shown in above image.

DigitOcean SSH Key

And Run these commands in Local System.

$ ssh-keygen
$ cat /c/Users/<Your User>/.ssh/docker_rsa
Enter fullscreen mode Exit fullscreen mode

Local SSH Key Generation

* Droplet after Creating

In you Project, you will be able to see one droplet.
Where you will get the public IP of that droplet and we will access that using that.

dropletIP

* Login and update Droplet

$ ssh -i docker_rsa root@165.22.212.229
$ sudo apt-get update
Enter fullscreen mode Exit fullscreen mode

login and update

After updating kernal, installing docker to the droplet.
Below is specific to Ubuntu

$ sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg \
    lsb-release
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
Enter fullscreen mode Exit fullscreen mode

Then we need to install Docker.

$ echo \
"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null 

$ sudo apt-get update && sudo apt-get install docker-ce docker-ce-cli containerd.io
Enter fullscreen mode Exit fullscreen mode

Verify Docker

To Verify Docker is running.

$ systemctl status docker
Enter fullscreen mode Exit fullscreen mode

Docker Verification

Hurray!! you are inside your first Droplet....

Top comments (5)

Collapse
 
peter279k profile image
peter279k • Edited

Some steps about installing docker are missed.

After running curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg command, it should run echo \
"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
and sudo apt-get update && sudo apt-get install docker-ce docker-ce-cli containerd.io to complete Docker installation.

More details about above Docker installation is available on official Docker doc.

Collapse
 
dporwal profile image
Deepak Porwal

Thanks @peter279k , Going to update this.

Collapse
 
peter279k profile image
peter279k

Or you can also check my docker_installer.sh shell script to complete Docker installation on Ubuntu 18.04 conveniently :).

Collapse
 
zinox9 profile image
Arjun Porwal

Awesome In Depth Guide !

Collapse
 
dporwal profile image
Deepak Porwal

Thanks :)