Connect with us

DevOps

Head Start with Docker Containers

If deploying software is hard, time-consuming, and requires resources from another team, then developers will often build everything into the existing application in order to avoid suffering the new deployment penalty.

― Karl Matthias, Docker: Up and Running

Installing Docker on Amazon Linux

Launch an Amazon Linux AMI with basic configurations. Wait until the launch is over and the initialization is done. I have launched the instance in a t2.Micro instance type for illustration purposes.

aws

Then SSH into the instance ssh -i "key.pem" ec2-user@public_ip_address

ssh_instance

Then update the image for fresh repositories and packages with sudo yum update -y.

update

Now install docker using sudo amazon-linux-extras install docker

install

Now append the ec2-user to access the docker service without acquiring the root permissions using sudo usermod -a -G docker ec2-user.

user_permission

Now start the docker service using sudo service docker start / sudo systemctl start docker

service_start

Now check the status of the service using docker info or docker ps.

docker_info

If you encounter any errors in the following output which can be Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
OR Client:
Debug Mode: false Server:
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.40/info: dial unix /var/run/docker.sock: connect: permission denied
errors pretty printing info

Then reload the service using sudo service docker restart / sudo systemctl restart docker. Then make sure the service is up and running!

If the whole installation process was successful the output of the docker ps will be something similar to image shown below.

docker_ps

For more DevOps related articles click here

Continue Reading
Advertisement

Trending