Anto Subash.

Published on

Setup docker in Ubuntu 18.04

Table of contents

Adding new user

1adduser docker-login
2usermod -aG sudo docker-login
3su - docker-login

Changing ssh

1nano /etc/ssh/sshd_config
2
3ClientAliveInterval 300
4ClientAliveCountMax 1
5AllowUsers root docker-login
6Port 234
7MaxAuthTries 5
8AllowTcpForwarding no                   # Disables port forwarding.
9AllowAgentForwarding no                 # Disables the forwarding of the SSH login.

Refresh and restart

1
2sshd -t
3
4systemctl restart sshd

Fail2ban

1apt install fail2ban
2systemctl enable fail2ban
3
4cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
5
6nano /etc/fail2ban/jail.local
7
8enabled = true
9port = 234
10
11systemctl restart fail2ban

Install Docker

1sudo apt update
2
3sudo apt install apt-transport-https ca-certificates curl software-properties-common
4
5curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
6sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
7sudo apt update
8apt-cache policy docker-ce
9sudo apt install docker-ce
10sudo systemctl status docker
11sudo systemctl enable docker
12sudo usermod -aG docker ${USER}
13su - ${USER}
14id -nG
15sudo usermod -aG docker docker-login
16docker