To Install Docker on Amazon EC2 instance:
- Update the installed packages for the instance
sudo yum update -y
- Install most recent Docker Community Edition package.
- Amazon Linux 2
sudo amazon-linux-extras install docker
- Amazon Linux
sudo yum install docker
- Start the Docker service
sudo service docker start

Note: Once started you should see two green [OK].
Note: To confirm that its been configured and created the command docker info will display information on the Docker.
- Running Docker info you will receive a permission error. We need to add the ec2-user to the Docker group first.

- Add the ec2-user to the Docker group to execute Docker commands without using sudo.
sudo usermod -a -G docker ec2-user
Note: If you still receive permission denied. Please restart the instance. May take 1-2 Minutes
- After adding ec2-user to the Docker group, you will notice below that you will have all the information on the Docker.
- How many Containers
- How many are Running
- How many Images are showing etc..
Docker info

Logging Setup using Docker Platform
- Docker Installation Command
sudo docker run --name='logdna' --restart=always \
-d -v=/var/run/docker.sock:/var/run/docker.sock \
-e LOGDNA_KEY="YOUR INGESTION KEY" \
-e TAGS="logdna" \
logdna/logspout:latest
Note: When you run this command LogDNA will not be found locally. This line - logdna/logspout: latest will always pull down the latest image.

- Check to see if the container has been configured.
docker ps

- Docker info will show that there is one container created and running

- To see the logs that will be displayed in LogDNA run the command:
docker logs logdna

To search for docker in LogDna:
meta.image.name:*

Links:
Docker Installation guide
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/docker-basics.html
Docker Ingestion Method
https://docs.logdna.com/docs/ingestion-methods