Goal
The goal of this project is to use Docker to setup a Linux distribution and check the cURL version. This should be a fairly quick tutorial since Docker is awesome and can do everything in a few commands.
Prereqs
📍Docker Engine & CLI installed
📍Internet connection
Let's Get Started!
The first thing that we need to do is install the Linux distribution of our choice. I'm using Ubuntu 22.04. We're also going to install bash alongside the installation so that we can immediately start doing the commands we need to once inside.
docker container run --name ubuntu --rm -it ubuntu:22.04 bash
Breaking It Down
-
--rm
makes cleaning up easier. Once I exit the container, the container will be wiped clean and removed rather than just stopped. -
--it
is actually two commands that are combined. -
-i
actually is-interactive
shortened and allows us to input directly into the container. -
-t
stands for-tty
which allows us to interact with the shell within the container.
You don't have to use Ubuntu, but the commands in the next section are Ubuntu specific. If you're using a different Linux distribution, check the docs for your distro on how to download cURL.
See If cURL Works
At this point you should be in your Ubuntu instance. Let's try to run curl --version
and see if we're all set!
It turns out that curl isn't installed by default in the Ubuntu 22.04 image. No problem, let's download it!
apt-get update && apt-get install curl
Breaking It Down
-
apt-get update
updates the system's repositories so that everything will work correctly when callingapt-get install
-
&& apt-get install curl -y
runs the cURL installation right after apt-get update finishes
See If cURL Works... Now?
Woohoo, time to celebrate!
Wrap Up
In this quick demo, I've shown how to use Docker to download and install cURL on a containerized Linux distribution. I am really coming to appreciate how quick and easy it is to work with Docker and am interested in seeing how I can utilize userdata with EC2 instances to make software installation a breeze.
Top comments (0)