[Intro Music]
Well, let's go on. In the
previous lecture we have created
the container using ubuntu image.
And here you see that its size is
around the 65 megabytes. It is
large in container world. And here
in this lecture I will demonstrate
how to use another image called
busybox.
But before doing that, let me
quickly summarize what we have
learned in the previous lecture.
You have seen that if you simply
create container using 'docker run
ubuntu' command, you will basically
see that container will be created
but it will be exited
automatically. That's because
process inside of that container
will be terminated automatically;
and if there are no processes
running, Docker will terminate such
container. It is a first important
outcome. Secondly, you have seen
that with option '-it', basically
it is a combination of two
different options, '-i' and
'-t', bit later I will explain
you what those options mean, you
were able to get access to bash
shell inside of the Ubuntu
container. And as soon as you are
logged into the container, it will
be still up and running. And we
were able to execute some basic
commands and for example, we have
listed the contents of the 'bin'
folder inside of the 'ubuntu'
container. But as soon as we exited
from bash shell, container was
terminated; and the reason for that
is the same as before, process bash
was terminated, there were no
another processes running, and
Docker has terminated such
container. That's that simple. Also
here in this output, you currently
see that there are two different
images available locally - ubuntu
and hello-world. And if you want to
create any container using already
existing images in your local
cache, then there was no need to
pull those images from Remote
Registry Docker Hub. Great. Let's
now get to our third example where
we will use busybox image, and let's
do the same as we have done with
ubuntu image, and let's simply type
'docker run busybox', Enter, again,
Unable to find image 'busybox'
locally; and now we are pulling such
image from a Remote Registry from
Docker Hub. Pull complete; Digest is
here, and Status: Downloaded newer image
for busybox:latest'. Basically, let
me shortly explain you what the
':latest' here and here means
each image has specific tag. And
this 'latest' here and here is
actually tag. If you don't
specify a tag for specific image
you want to use, here we have
specified simply name of the image
'busybox', Docker will append that
'latest', 'latest' is usually latest
stable version of each image. But
you are able to use different tags
and usually same image may have
multiple different tags. And we
will look at it a bit later. For
now please understand that this is
simply tag. And if you don't
specify a tag for image you want to
use, then that 'latest' will be added
automatically. Great. We have tried
to run busybox container, and again
we have returned back to our
terminal. And behavior here is the
same as we have observed when we
were running ubuntu image. And if I
will enter 'docker ps' now, you'll
see that there were no containers
currently running. But if I enter
'docker ps -a', you'll see that
there was a busybox container that
was exited, in my case five minutes
ago. And the fourth command that
was executed was 'sh' command. 'sh'
is basically also shell same as
with bash, but you see here that
there was no path to '/bin'
folder. We have simply executed
under the hood 'sh' command. Great.
Let's now try to enter this
container using '-it' option. Let
me clear terminal and run
container like so. 'docker run -
it busybox'. In such case we will not
again pull busybox image from
Remote Registry because it's
already present in our local cache.
OK, enter and we are now inside of
the busybox container. And if I'll
enter 'docker ps' now in another tab,
'docker ps', you will see that there
is busybox container running right
now and it is 'Up 40 seconds'. Okay,
let's now use the 'ls' command and
see whether such command is
available inside of this container.
'ls', and yes, this command is here
But you see much shorter list of
folders than we have seen in ubuntu
container. Let's have a look at
contents of the 'bin' folder 'ls bin',
and you'll see such a list of
executables here inside of the bin
folder. And for example, if you try
to find the 'echo' command, it will
be present here as well. And you
are able to use it of course, 'echo
"Hello from Busybox"
and Enter, and you'll see, "Hello from
Busybox" here in this shell. Also,
let's try one more command, for
example 'uptime'. You see that this
command should be present here on
this list. Let me scroll a bit up
and here was this command 'uptime'.
Let's press Enter. And you'll see
uptime of this Linux container, it
is up around six minutes. Also, it
has such commands as 'mkdir', you're
able to create a new folder. For
example, let's create 'my-
folder'. Let's 'cd' into 'my-folder'.
And here let's create a new file
'touch file.txt'. And you'll see
that new file was created. It means
that this container has a really
nice set of utilities that you are
able to use out of the box. Also,
if you want, you're able to install
additional utilities if you need to
do so. But what is actually BusyBox?
BusyBox is a really small
distribution that has a really
large set of utilities, but those
utilities are custom, and they are
actually really small in size. And
usually this BusyBox installation
is packaged as a single executable
file. And now let's have a look at
the size of this busybox image in
comparison to ubuntu image. Let's
exit this container like so. And if
I list the containers that are
running right now, you'll see that
there are no containers. Let me do
that. 'docker ps'. Yes, there are no
containers currently running,
because we have exited the 'sh'
process, and container was
automatically terminated. And if
I'll have a look at the history,
you'll see that there was busybox
container that was exited 19
seconds ago. Great. I wanted to
show you size of busybox container.
Let's clear terminal and list local
images, 'docker images'. And you'll
see a ubuntu, busybox,
hello-world here on the list. And
now have a look at the size of
busybox image. It is a bit larger
than one megabyte. In comparison to
ubuntu size this size is really
really insanely small. That's the
smallest Linux container available.
It has again a built in set of
utilities, and you are able to use
them but it is much much much more
smaller than ubuntu image. Great.
That's how you're able to create
containers using busybox image.
Let's now proceed, and next let me
show you one more image that is
based actually on busybox image, and
that image is called alpine. Let's
have a look at it next. Bye-Bye.
[no audio]