How to install and use Amazonlinux on Docker Container

Amazon Linux AMI (Amazon Machine Image) which is based on Red Hat Enterprise Linux is a Linux Image available on Amazon Cloud to provide a stable, secure, and high-performance server platform. Just like CentOS, it is a derivative of RHEL, however, supported and maintained by Amazon Web Services to use on Amazon EC2 (Amazon Elastic Compute Cloud). This ensures the AWS users wouldn’t face any problems such as abandoning the project, remove long-term support, or delayed updates.

In case you want to experience AmazonLinux then we can install it on Docker Container, here are the steps to follow…

Install Docker -CE

Your existing system or server must have a pre-installed docker machine to download and use Amazon Linux. However, if you not, then follow the below links to set it up as per your OS.

 

Pull Amazonlinux 2.0 on Docker

Now, using the command tool of Docker, we will fetch the latest available version of this Linux server operating system.

docker pull amazonlinux

Output:

Using default tag: latest
latest: Pulling from library/amazonlinux
3c2c91c7c431: Pull complete 
Digest: sha256:06b9e2433e4e563e1d75bc8c71d32b76dc49a2841e9253746eefc8ca40b80b5e
Status: Downloaded newer image for amazonlinux:latest
docker.io/library/amazonlinux:latest

 

Create container

Once the downloading of the AmazonLinux docker image is done, let’s use the run command to create its container.

docker run -it --name amazon -d amazonlinux

Check running containers-

docker ps

Run Amazon Linux Docker conainer with root

Connect Amazon Linux bash with root user rights

To connect the running container bash, execute the follwing command with root rights-

docker exec -it --user root amazond /bin/bash

install and use Amazonlinux on Docker Container

Start/Stop

To stop and start container:

docker stop amazon

docker start amazon

 

Other Articles:

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.