In the first article in our SystemTap series, we learned how to install the powerful diagnostic tool, SystemTap, on an AWS EC2 instance and then wrote our very first “Hello World” script. We now need to explore some of the interesting (and more useful) scripts that come with SystemTap.
Building a SystemTap target environment
To make this article easier to read, we will split it into two parts. In this post, we will provide a Red Hat Enterprise Linux 7 platform container image with Docker on an AWS EC2 instance. After the SystemTap target environment is properly built, the final part will show how to run some serious scripts on a Docker container from its EC2 host to illustrate just how useful SystemTap can be.
Installing Docker on your AWS EC2 instance
To install Docker on an AWS EC2 instance, we’ll enable the “Red Hat Enterprise Linux Server 7 Extra(RPMs)” yum repository that, by default, is disabled.
$ sudo yum repolist disabled Loaded plugins: amazon-id, rhui-lb repo id repo name rhui-REGION-rhel-server-debug-extras/7Server/x86_64 Red Hat Enterprise Linux Server 7 Extra Debug (Debug RPMs) rhui-REGION-rhel-server-debug-optional/7Server/x86_64 Red Hat Enterprise Linux Server 7 Optional Debug (Debug RPMs) rhui-REGION-rhel-server-debug-rh-common/7Server/x86_64 Red Hat Enterprise Linux Server 7 RH Common Debug (Debug RPMs) rhui-REGION-rhel-server-debug-rhscl/7Server/x86_64 Red Hat Enterprise Linux Server 7 RHSCL Debug (Debug RPMs) rhui-REGION-rhel-server-debug-supplementary/7Server/x86_64 Red Hat Enterprise Linux Server 7 Supplementary Debug (Debug RPMs) rhui-REGION-rhel-server-extras/7Server/x86_64 Red Hat Enterprise Linux Server 7 Extra(RPMs) rhui-REGION-rhel-server-optional/7Server/x86_64 Red Hat Enterprise Linux Server 7 Optional (RPMs) rhui-REGION-rhel-server-releases-source/7Server/x86_64 Red Hat Enterprise Linux Server 7 (SRPMs) rhui-REGION-rhel-server-rhscl/7Server/x86_64 Red Hat Enterprise Linux Server 7 RHSCL (RPMs) rhui-REGION-rhel-server-source-extras/7Server/x86_64 Red Hat Enterprise Linux Server 7 Extra (SRPMs) rhui-REGION-rhel-server-source-optional/7Server/x86_64 Red Hat Enterprise Linux Server 7 Optional (SRPMs) rhui-REGION-rhel-server-source-rh-common/7Server/x86_64 Red Hat Enterprise Linux Server 7 RH Common (SRPMs) rhui-REGION-rhel-server-source-rhscl/7Server/x86_64 Red Hat Enterprise Linux Server 7 RHSCL (SRPMs) rhui-REGION-rhel-server-source-supplementary/7Server/x86_64 Red Hat Enterprise Linux Server 7 Supplementary (SRPMs) rhui-REGION-rhel-server-supplementary/7Server/x86_64 Red Hat Enterprise Linux Server 7 Supplementary (RPMs) repolist: 0
We’ll use the yum-config-manager to enable the repo:
$ sudo yum-config-manager --enable "Red Hat Enterprise Linux Server 7 Extra(RPMs)"
Next, you should search for the Docker package and install it. Yum will take care of its dependencies.
$ sudo yum search docker Loaded plugins: amazon-id, rhui-lb rhui-REGION-rhel-server-extras | 2.9 kB 00:00:00 rhui-REGION-rhel-server-releases | 3.7 kB 00:00:00 rhui-REGION-rhel-server-releases-debug | 2.9 kB 00:00:00 rhui-REGION-rhel-server-rh-common | 3.8 kB 00:00:00 rhui-REGION-rhel-server-extras/7Server/x86_64/primary_db | 56 kB 00:00:00 rhui-REGION-rhel-server-extras/7Server/x86_64/updateinfo | 27 kB 00:00:00 ========================================================== N/S matched: docker ========================================================== docker-logrotate.x86_64 : cron job to run logrotate on docker containers docker-python.x86_64 : An API client for docker written in Python docker-registry.noarch : Registry server for Docker docker-registry.x86_64 : Registry server for Docker docker-selinux.x86_64 : SELinux policies for Docker docker.x86_64 : Automates deployment of containerized applications Name and summary matches only, use "search all" for everything. $ sudo yum -y install docker
Once the Docker-related packages are installed, you should enable and start the docker service.
$ sudo systemctl enable docker ln -s '/usr/lib/systemd/system/docker.service' '/etc/systemd/system/multi-user.target.wants/docker.service' $ sudo systemctl start docker $ sudo systemctl status docker docker.service - Docker Application Container Engine Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled) Active: active (running) since Wed 2015-09-16 02:02:26 EDT; 20ms ago Docs: http://docs.docker.com Main PID: 10738 (docker) CGroup: /system.slice/docker.service └─10738 /usr/bin/docker -d --selinux-enabled --add-registry registry.access.redhat.com Sep 16 02:02:00 ip-172-30-0-123.ap-southeast-1.compute.internal systemd: Starting Docker Application Container Engine... Sep 16 02:02:00 ip-172-30-0-123.ap-southeast-1.compute.internal docker: time="2015-09-16T02:02:00.179717121-04:00" level=inf...k)" Sep 16 02:02:00 ip-172-30-0-123.ap-southeast-1.compute.internal docker: time="2015-09-16T02:02:00.447391712-04:00" level=err...se" Sep 16 02:02:26 ip-172-30-0-123.ap-southeast-1.compute.internal docker: time="2015-09-16T02:02:26.342873074-04:00" level=war....10 Sep 16 02:02:26 ip-172-30-0-123.ap-southeast-1.compute.internal docker: time="2015-09-16T02:02:26.360314551-04:00" level=inf...se" Sep 16 02:02:26 ip-172-30-0-123.ap-southeast-1.compute.internal docker: time="2015-09-16T02:02:26.798683604-04:00" level=inf...t." Sep 16 02:02:26 ip-172-30-0-123.ap-southeast-1.compute.internal docker: time="2015-09-16T02:02:26.798853557-04:00" level=inf...e." Sep 16 02:02:26 ip-172-30-0-123.ap-southeast-1.compute.internal docker: time="2015-09-16T02:02:26.798869375-04:00" level=inf...on" Sep 16 02:02:26 ip-172-30-0-123.ap-southeast-1.compute.internal docker: time="2015-09-16T02:02:26.798882151-04:00" level=inf...7.1 Sep 16 02:02:26 ip-172-30-0-123.ap-southeast-1.compute.internal systemd: Started Docker Application Container Engine. Hint: Some lines were ellipsized, use -l to show in full.
In order to use Docker with the ec2-user normal user, we need to create a docker group and add ourselves in it.
$ sudo groupadd docker $ sudo usermod -aG docker ec2-user $ grep ^docker /etc/group dockerroot:x:995: docker:x:1001:ec2-user
Provisioning Red Hat Enterprise Linux 7 container with Docker
To provision our container with Docker, pull down the Red Hat Enterprise Linux 7 platform container image from Red Hat.
$ docker pull rhel7 Trying to pull repository registry.access.redhat.com/rhel7 ... 82ad5fa11820: Download complete Status: Downloaded newer image for registry.access.redhat.com/rhel7:latest
Run docker images to list the container we have downloaded.
$ docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE registry.access.redhat.com/rhel7 latest 82ad5fa11820 6 days ago 158.3 MB
Let’s do a quick test to see if everything is working.
$ docker run -ti rhel7 /bin/bash Usage of loopback devices is strongly discouraged for production use. Either use `--storage-opt dm.thinpooldev` or use `--storage-opt dm.no_warn_on_loop_devices=true` to suppress this warning. [root@35f99cabc19a /]# cat /etc/redhat-release Red Hat Enterprise Linux Server release 7.1 (Maipo) [root@c8a8740808c0 bin]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/docker-202:2-51421425-c8a8740808c0d41b7294f6f2906543740b7a9b54791b6f5bed6a150616b18dd5 9.8G 213M 9.0G 3% / tmpfs 497M 0 497M 0% /dev shm 64M 0 64M 0% /dev/shm tmpfs 497M 20K 497M 1% /run/secrets /dev/xvda2 10G 3.6G 6.5G 36% /etc/hosts [root@c8a8740808c0 bin]#
So far so good! We are now ready to run some real troubleshooting scripts against our VMs…which we’ll describe in the final installment of this series.
If you want to learn more on Docker, this is your go-to course Introduction to Docker.
New Content: AWS, Azure, Typescript, Java, Docker, 13 New Labs, and Much More
This month, our Content Team released a whopping 13 new labs in real cloud environments! If you haven't tried out our labs, you might not understand why we think that number is so impressive. Our labs are not “simulated” experiences — they are real cloud environments using accounts on A...
Kickstart Your Tech Training With a Free Week on Cloud Academy
Are you looking to make a jump in your technical career? Want to get trained or certified on AWS, Azure, Google Cloud Platform, DevOps, Kubernetes, Python, or another in-demand skill?Then you'll want to mark your calendar. Starting Monday, June 22 at 12:00 a.m. PDT (3:00 a.m. EDT), ...
New Content: AZ-500 and AZ-400 Updates, 3 Google Professional Exam Preps, Practical ML Learning Path, C# Programming, and More
This month, our Content Team released tons of new content and labs in real cloud environments. Not only that, but we introduced our very first highly interactive "Office Hours" webinar. This webinar, Acing the AWS Solutions Architect Associate Certification, started with a quick overvie...
Azure vs. AWS: Which Certification Provides the Brighter Future?
More and more companies are using cloud services, prompting more and more people to switch their current IT position to something cloud-related. The problem is most people only have that much time after work to learn new technologies, and there are plenty of cloud services that you can ...
Blog Digest: 5 Reasons to Get AWS Certified, OWASP Top 10, Getting Started with VPCs, Top 10 Soft Skills, and More
Thank you for being a valued member of our community! We recently sent out a short survey to understand what type of content you would like us to add to Cloud Academy, and we want to thank everyone who gave us their input. If you would like to complete the survey, it's not too late. It ...
New Content: Alibaba, Azure Cert Prep: AI-100, AZ-104, AZ-204 & AZ-400, Amazon Athena Playground, Google Cloud Developer Challenge, and much more
This month, our Content Team released 8 new learning paths, 4 courses, 7 labs in real cloud environments, and 4 new knowledge check assessments. Not only that, but we introduced our very first course on Alibaba Cloud, and our expert instructors are working 'round the clock to create 6 n...
Top 5 Reasons to Get AWS Certified Right Now
Cloud computing trends are on the rise and have been for some time already. Fortunately, it’s never too late to start learning cloud computing. Skills like AWS and others associated with cloud computing are in high demand because cloud technologies have become crucial for many businesse...
Introducing Our Newest Lab Environments: Lab Playgrounds
Want to train in a real cloud environment, but feel slowed down by spinning up your own deployments? When you consider security or pricing costs, it can be costly and challenging to get up to speed quickly for self-training. To solve this problem, Cloud Academy created a new suite of la...
Blog Digest: AWS Breaking News, Azure DevOps, AWS Study Guide, 8 Ways to Prevent a Ransomware Attack, and More
New articles by topicAWS Azure Data Science Google Cloud Cloud Adoption Platform Updates & New Content Security Women in TechAWSBreaking News: All AWS Certification Exams Now Available Online As an Advanced AWS Technology Partner, C...
AWS Certified Solutions Architect Associate: A Study Guide
Want to take a really impactful step in your technical career? Explore the AWS Solutions Architect Associate certificate. Its new version (SAA-C02) was released on March 23, 2020, though you can still take SAA-C01 through July 1, 2020. This post will focus on version SAA-C02.The AWS...
New on Cloud Academy: AWS Solutions Architect Exam Prep, Azure Courses, GCP Engineer Exam Prep, Programming, and More
Free content on Cloud Academy More and more customers are relying on our technology and content to keep upskilling their people in these months, and we are doing our best to keep supporting them. While the world fights the COVID-19 pandemic, we wanted to make a small contribution to he...
Breaking News: All AWS Certification Exams Now Available Online
Remote proctoring for all AWS certifications Cloud Academy is an Advanced AWS Technology Partner, and we are happy to announce all AWS certification exams are available online! What does this mean for you? You can stay focused on your certification goal. Or you can start a certifica...