How to Run Springboot Application on Docker, Ubuntu and AWS EC2

Launch EC2 instance

Give a name

Time to launch instance

  • Successfully initiated launch of instance
    • Initializing requests
    • Creating security groups
    • Creating security group rules
    • Launch initiation

Instance details

PuTTY configuration

User ubuntu, not root

Use the following command to all the updates:

sudo apt update

sudo apt install apt-transport-https ca-certificates curl 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 bionic stable"

apt-cache policy docker-ce

sudo apt install docker-ce
sudo systemctl status docker

You have successfully installed the docker on AWS Ubuntu:

Docker login

docker login

permission denied while trying to connect to the Docker daemon socket at unix

Solution

sudo usermod -a -G docker $USER
sudo reboot

Rebooted and worked…!

Verify that you can run docker commands

docker run hello-world

Pulling the docker image and Running the SpringBoot application

docker run --name project33 -p 8080:8080 yuriyni/project33