[Intro Music]
We have just explored the image
called BusyBox. BusyBox is
basically not a full feature of the
Linux operating system. Instead, it
is just a set of Linux utils. And
now in this lecture I will
demonstrate you how to use another
image called Alpine. And let's
first try to pull this image using
'docker pull' command. We have not
used this command before, but this
command will simply pull image from
Remote Registry Docker Hub. Let's
do that. At the moment, we actually
have three images, ubuntu, busybox,
and hello-world. And now let's pull
one more image, 'docker pull alpine'
without any tags, just 'alpine'. And
you see that we are using the
default tag 'latest', and we are
pulling this image from Docker Hub.
Image was pulled, here is its SHA
256 Hash. And if I repeat the same
command again, 'docker pull alpine',
you'll see that Docker server will
try to pull the same image again,
but you'll see status that 'Image is
up to date for alpine:latest'.
Basically all what happens here, in
this case, we are comparing those
hashes, this one and this one, and if
the image Docker decides that we
already have latest image available
locally in a local hash, and if I
list images, local images now
'docker images', you'll see this new
image, 'alpine' on the list. That is
latest IMAGE ID is here, CREATED
'2 weeks ago', and its SIZE is 5.6
megabytes. Notice that the alpine
image is larger than busybox
image, busybox image was a bit
larger than one megabyte, but alpine
is still much much smaller
than ubuntu image, that is 64
megabytes in size. Now let's try to
create a new container based on
alpine image. And afterwards, I'll
create one more container with
busybox image. And I'll try to
compare those two images and show
you differences between them. But
basically, alpine is based on
busybox; and again, I'll prove it
to you in this lecture. Okay,
great. Let's first create a new container
based on alpine image. Let's
create it like so, 'docker run -
it', because I need to get into 'ch'
shell inside of this container. And
let's type here name of the image
'alpine' like so. Container was
created. And I have automatically
logged into ch shell inside of that
container. Let's use ls command
here and you'll see a set of
folders inside of alpine
container. Great. Let's in
parallel, create one more container
and it will be busybox container.
Let me open up a new tab here. And
let's create a new container 'docker
run -it' again, and here will be 'busybox'.
Again, I have logged into ch shell
inside of that container. And if I
list the folders here, you will see
less folders than we have seen here
in alpine container. Now, let's do the
following. Let's try to explore a
version of Linux operating system
here in this container, alpine
container. Let me clear terminal, and
type 'cat /etc/os-release'.
And I'll see release
version of this container. It is
Alpine Linux version 3.11.
And that proves that this
container is basically running
Linux operating system. And here
is the link, you could copy this link,
and go to your web browser. Let me
do that quickly. Go to Google
Chrome, and paste link here, and on
this page you're basically able to
read the details about Alpine Linux,
what is that? And here you actually
see that Alpine Linux is security-
oriented, lightweight Linux
distribution based on musl libc
and busybox. Okay, now let me show
you why alpine is actually based on
busybox and how you're able to
verify that. Let's list files in 'bin'
folder, 'ls bin'; and you'll see here
bunch of actually links to BusyBox
utilities. Let me execute the same
command as I had executed before, I mean
'cat /etc/os-release' in busybox
container. Let's go to this tab
where we have started busybox and
let's type 'cat /etc/os-release',
same command as we
have just entered in alpine
container, Enter, and you'll see this
error, can't open '/etc/os-release':
No such file or directory,
and that proves that BusyBox is not
basically a full featured Linux
operating system, it is just a set of
utilities, nothing else. Let's
basically compare the contents of
'etc' folder here in busybox
container and alpine container.
Let's list files here, 'ls etc'; and
let's list files here, 'ls etc'; and
you'll see here much more files and
folders than we have seen here in
this output in busybox container.
Okay, let's now try to compare
contents of the 'bin' folders here
and here. Let's list files here in
'bin' folder; and let's list files
here in busybox, 'ls bin'. You'll see
here much more actually files in
busybox container than here. But if
you execute the 'ls -la' command
'bin', you'll see that all commands
here in alpine container are
basically shortcuts for busybox
commands. You see that, for
example, 'ps' command is shortcut,
and it links us to '/bin/busybox'
executable script. Let me show you
something. If you simply type
'busybox' here in alpine container,
you'll see actually description of
busybox commands. And if you scroll
up, you may read that the 'BusyBox
is a multi-call binary that
combines many common Unix utilities
into a single executable'; and this
executable is included into alpine
container. That's that simple.
That's why you are able to use all
commands that are available in
busybox inside of the alpine
container, because of those hard
coded links. For example, this
command 'sed', links to be busybox
command, and so on. You could
actually try to do that. And for
example, let's read the help for 'ifconfig'
command. 'ifconfig --
help. You'll see this output -
BusyBox v1.31.1, and
so on. And description of options
for 'ifconfig' command. If I will do
the same in busybox container,
'ifconfig --help', you'll
see actually exactly the same
result - BusyBox v1.31.1,
and so on. Same result as
here. And again, that proves that
alpine image is based on busybox
image. But there are some
additional folders and files that
make alpine image basically a
fully featured Linux operating
system. That's how it looks like in
comparison between alpine and
busybox images. Great. What else I
wanted to show you. Let me also
list the contents of the 'sbin'
folder here in alpine container.
Let me actually use 'ls -la sbin'.
And also in this folder, you
will see that there are a bunch of
actually links to '/bin/
busybox'. Like reboot, that points to
'/bin/busybox'; 'poweroff', and so on.
But if I scroll a bit up, let me do
that, you'll see additional scripts
like 'ldconfig', 'mkmntdirs', and
also you should see here 'apk'
script, let me scroll a bit up,
yes here it is. And with this
script, you are able to install
additional packages inside of the
alpine container. And if you enter
'apk --help', you'll see
actually help for 'APK' command. And
if you scroll up, you'll see that
there is no information about
BusyBox at the top. This is because
this script was added additionally
to scripts built in into BusyBox.
And if I'll go to BusyBox here and
enter 'apk', I will get answer
'apk: not found'. And that's because
'apk' is absent by default in
BusyBox. Great. Let me also show
you how you're able to start
specific scripts using busybox
scripts. For example, let me clear
terminal and type here, I am now in
alpine container, 'busybox ifconfig',
and you'll get a result of 'ifconfig'
command using busybox
script. And again that proves that
busybox is just a set of
utilities and you are able to use
those utilities like so. Or let's
use busybox, for example, 'traceroute'
command and here let's trace
route path to google.com. It seems
that something is broken on a way
but anyway let's for example use
ping instead of traceroute, and you
will see answer from google.com web
server. And also you are able to do
following. You are able to use ping
without busybox prefix. Simply,
'ping google.com', and you'll get
the same result. And the reason for
that is that ping is simply link to
'busybox ping'. Let me show you that
'ls bin', and you'll see ping here
on the list, but in order to verify
that it is actually linked to
busybox, you could use 'ls -la
bin'; and if you scroll up, you'll
see that ping is simply link to
'/bin/busybox'. That's that simple.
Great. That's the comparison of
busybox and alpine. And actually,
alpine is a very popular choice for
creation of additional images,
custom images, it is really small
in size, it is a bit more than five
megabytes. Let me show you it
again. Actually, now I'm located in
alpine container, and I need to go
out of it. Actually, let me open up
a new tab and list images here,
'docker images', and here you'll see
sizes for alpine image, for busybox
image, and for ubuntu image. Let's
shortly summarize what we have
explored here in this lecture. We
have compared alpine and busybox
images. And you have see that the
BusyBox is basically just a set of
utilities, nothing else; and Alpine
is full feature of the operating
system, that's called Alpine Linux,
but it's based on BusyBox; and it
reuses utilities that are included
in BusyBox. But it also has some
additional features. For example,
it has 'apk' utility that allows
you to install additional packages
or modules inside of the operating
system. And Alpine is very often
used as a base layer for custom
images. Okay, I hope you enjoyed
this comparison, and now you
understand difference between
Alpine and BusyBox, and now you
should understand that there was no
need to use such large images,
for example, like ubuntu, that is
much much larger than alpine or
busybox. And if you just need the
Linux command line and some basic
utilities, you could go ahead with
Alpine. Okay, that's all for this
large lecture. And in the next one
let's proceed and explore some
additional images. See you next bye-bye.
[no audio]